consolidates two separate APIs — setProxy and setTransports — into a single unified updateConnectSettings method. This is a clean API simplification across the entire Connect surface (Node, browser, mobile, webextension, desktop).
@trezor/connect tests
jest test
Testing @trezor/connect npm package in nodejs environment.
./docker/docker-connect-test.sh
you may use the following params:
-f <semver string such as 2.5.2>
-p <pattern to match tests files>
-i <in case -p methods, use -i to filter one connect method, such as -i binanceGetAddress>
karma test
Browser console is not visible in the terminal. Use KARMA_SINGLE_RUN env variable and debug test at http://localhost:8099/debug.html in your favorite browser.
For local changes to take effect build connect-iframe or connect-web depending where they were made and restart test.
TESTS_PATTERN="init" KARMA_SINGLE_RUN=false yarn workspace @trezor/connect test:e2e:web
Transactions cache
Bitcoin-like coins signTransaction method require additional data about transactions referenced from used inputs.
Those data are automatically downloaded from backend defined in coins.json by default if refTxs param is not specified.
Note: Backends hosted on *.trezor.io are limiting requests per min.
Too many requests from not whitelisted origins may be penalized with temporary ban. ("All backends are down" error)
Backend connection will be omitted in case of providing refTxs so even coins without officially supported backends (like zcash testnet) may sign a transaction in "offline mode". see docs
To reduce network traffic Github Actions CI is using cached (offline) mode and whitelisted Github CI is using default (online) mode.
Cached transactions are stored in ./tests/__txcache__ directory in the same structure as in trezor-firmware repository.
Cached transactions are provided to test fixtures via TX_CACHE utility.
Missing tx json? use this tool to generate it.
Websocket cache
Similar to transaction cache. If process.env.TESTS_USE_WS_CACHE is set to true then @trezor/blockchain-link is conditionally connected to a local websocket server returning cached results from ./tests/__wscache__.