Adding wasm level test fixture and default test #321
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Fixes: https://github.com/orgs/shop/projects/147/views/9?pane=issue&itemId=125817929&issue=shop%7Cissues-shopifyvm%7C552
We want to have a way for developers to test their compiled functions for various scenarios and find out when it breaks everytime they make changes to their extension. We want to develop a test suite that they can run which actually builds a function and runs a function with a previous run's logged input and asserts its the same as the logged output.
We are adding a default passing wasm-level test fixture and test to all function extension templates to which developers can add on.
These wasm-level tests replace the unit tests that are baked into the templates.
Solution
I created an app with every type of extension in both JS and Rust and then created a fixture along with a default test that passes, then copied the test directory for each extension over here to its corresponding template so I feel pretty confident in my changes, even though I haven't tophatted it, unsure how I can tophat this.
The
package.jsonin all the test directories are the same. Thedefault.test.jsfor different extensions have different input query path but is otherwise the same.There is a second follow-up PR that removes all existing unit tests.
This PR also needs this helper to get published to NPM.
Checklist