Closed jpcapurro-atixlabs closed 4 years ago
update: I tried to test the wasmWrapper but I wasn't able to.
The jest tests run in node, but the app normally runs in a browser, and the way we import()
the js-chain-libs doesn't play nicely with node.
I first suspected it might've been an issue with the module not being passed throug babel-jest
, since it resides inside node_modules
, but making an exception for it didn't solve the issue.
Updating to node 12 or 13, which have native support for dynamic imports, made the tests fail earlier, with an 'cannot use import outside a module' error. I tried adding "type": "module"
in package.json
, and changing filename extensions to .mjs
, but couldn't figure this out.
I'll have this PR only test the sendTransaction action, and create another one with the updates to the dependencies (I tried a yarn upgrade
and dealt with its aftermath, and I'm not throwing that away. Also, on the latest versions npm audit
reports only one low level vulnerability)
The remaining alternative to test the wasmWrapper
is to use a different way of instantiating the js-chain-libs
, doing so manually in a beforeAll
jest hook, as seen in: https://hub.packtpub.com/testing-webassembly-modules-with-jest-tutorial/
update: created another PR with the update to the dependencies: https://github.com/input-output-hk/js-chain-libs/pull/114
There are some errors in the console when running
yarn test
(which may be addresses in a later PR)
The config file for testing was added in: https://github.com/input-output-hk/js-chain-libs/pull/114/files
depends on: https://github.com/input-output-hk/js-chain-libs/pull/111
I'll try to make unit tests for:
I'd also like to try making e2e or integration tests, but that'll probably be best reserved for a future PR.
Integration with CircleCI might or might not make it into this PR