Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Building some command-line tests for blocks #41

Merged
merged 14 commits into from
Aug 19, 2019
Merged

Building some command-line tests for blocks #41

merged 14 commits into from
Aug 19, 2019

Conversation

gvwilson
Copy link
Owner

@gvwilson gvwilson commented Aug 16, 2019

Testing things by mousing and clicking is annoying, so I built a command-line widget to load the blocks code and generate some text (but not eval it, yet).

This depends on #39 and #40 - please merge those first.

  1. npm run test in the project's root directory to run it.

  2. tests/test.js reads ./index.html from standard input, finds all the blocks scripts, and eval's them.

  3. In order for those eval's to work, tests/test.js defines simplified placeholders for the things the blocks need as they load up. (I figured this out by looking at "cannot find" error messages as blocks loaded and implementing each thing one by one.)

  4. There is then an object Tests that has a bunch of tests, each written as a single function of no arguments with a meaningful name as its key. We loop over those, calling each function in turn; those functions create blocks, and we display the text they would generate.

This still requires manual inspection of output, but it's a step toward being able to check blocks without having to reload, drag, and click. The next steps will be to implement tests for the other blocks in generators/js/*.js and then add checks inside the tests to compare the actually-generated code with what we're expecting.

# This is the 1st commit message:

Trying to build testing harness

# This is the commit message #2:

Working on test harness

# This is the commit message #3:

Tidying up text of block visuals
@gvwilson gvwilson requested a review from MayaGans August 16, 2019 11:45
@gvwilson gvwilson merged commit 2555d00 into gvwilson:master Aug 19, 2019
@gvwilson gvwilson deleted the test branch August 20, 2019 21:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant