Releases: onflow/flow-js-testing
v0.3.0-alpha.10
v0.3.0-alpha.9
v0.3.0-alpha.8
Minor Changes
- 033562b: Dynamically select ports for emulator instead of supplying admin port statically through emulator.start arguments, deprecate use of this argument
v0.2.2 Upgrade how to detect emulator readiness
What's Changed
Instead of reading logging lines from the emulator, the flow-js-testing library now makes a gRPC API call via FCL on getBlock() API to determine if the emulator is fully started. This change will address the intermittent test failures caused by prematurely flags emulator in a ready state.
New Contributors
Full Changelog: v0.2.1...v0.2.2
Fixed getContractAddress method
Due to refactoring getContractAddress
method was returning a tuple, which would lead to a trailing comma inside of the import statement and breaking of most of interactions. We've spotted what was causing this behaviour, fixed it and added additional tests to prevent this from happening in the future 😁
Major Update - Return Value
Interaction Return Value
sendTransaction
and executeScript
functions now return a tuple of [result, error]
. As do the following functions:
-
updateContract
-
setBlockOffset
-
registerContract
-
mintTokens
-
initManager
-
deployContract
-
createAccount
-
setBlockOffset
-
mintFlow
-
getManagerAddress
-
getContractAddress
-
getBlockOffset
-
getBalance
-
getAccountAddress
-
checkManager
-
getBlockOffset
-
getFlowBalance
Any code that relies upon checking the result of any of these functions and expects only the result returned will need to be refactored.
Jest asserts were updated accordingly, but if you were writing your own you will need to update them.
For examples of new usage see the script, transaction and api documentation.
Limited Interactions
Interaction Limit
Both scripts
and transactions
now accepts limit
field for all your heavy interactions. Default value is 999
Package Updates
flow-cadut
and other supporting packages were updated to latest versions
Block Offsets and Argument Resolvers
⭐️ Block Offset Functionality
With this release we are adding functionality to offset current block height by calling setBlockOffset
method. This should enable time based lock functionality in your contracts, transactions and scripts. Please refer to API in documentation for available methods and examples.
⭐️ Runnable Examples
On top of examples you can find in documentation we added several examples showcasing usage of framework to examples
folder. You can run any of the example located there with simple node run {name | number}
command from withing that folder.
⭐️ Fixed Complex Arguments
Updated version of flow-cadut
will help resolve complex arguments like arrays of dictionaries with ease.
Version 0.1.13
⭐ Bootstrap Testing Environment
You can initiate your testing environment with one simple command:
npx flow-js-testing init
⭐ Generate Test Suit
Create a test suit file for your project with all the necessary imports and setup for describe blocks.
npx flow-js-testing make [name]
You can start writing your asserts and expectations right away.
Updated Dependencies
flow-cadut
dependency is fixed and now arguments with complex types - i.e. metadata of {String:String}
- should work properly.
Fixed Emulator Logging
Previously emulator would cause Jest to throw an error after test is executed, when logging
option is set to true
. This issue is fixed now.
Update for new `flow.json` schema
Flow CLI version v.0.25.1 changed plural keys
to singular key
on service account, breaking the framework.
init
method will now properly source it's value from key
field and provides a fallback in case similar case occur in the future.
port
and pkey
can now be passed via options object as second argument:
const port = 8080;
const pkey = "48a1f554aeebf6bf9fe0d7b5b79d080700b073ee77909973ea0b2f6fbc902"
await init(basePath, { port, pkey });
Both of them are optional, so if you are OK with default values, you can make it into one-liner:
await init(basePath);