Soracom Orbit
Testing Inside the Development Environment
AssemblyScript
While you can test your code using any method that you prefer, you can use Jest to perform snapshop testing, which will store the output of a test in order to detect if the output changes when editing code.
This test will execute your code on the Node.js Orbit runtime-comptaible execution environment running inside the development container, which allows you test your code locally without deploying your code to Soracom.
-
Define a test case in
tests/inputs.ts
-
Run the test using one of the following methods in VS Code:
- Open the NPM Scripts view, select the
test
script, and click Run - Open the integrated terminal and run
npm test
- Open the command palette (
⌘-⇧-P
orCtrl-Shift-P
) and run theRun Test Task
command - Run the test command using the
F5
shortcut
Note that you cannot set breakpoints in AssemblyScript
- Open the NPM Scripts view, select the
When you define a new test case and run it for the first time, the tests/__snapshots__/
directory will be created.
When you modify your WASM module and the resulting test output changes, the test will result in an error containing the differences from the previous test found in tests/__snapshots__/
. If the new test reflects the correct result, you can update the snapshot using the test:updateSnapshot
script or npm test:updateSnapshot
command.
Running the snapshot test will output a JSON file in the tests/inputs/
directory. This file can also be used as an input file when running tests remotely after uploading a WASM module to Soracom.
Rust
There are no test samples at this time.
C/C++
There are no test samples at this time.
TinyGo
There are no test samples at this time.