Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Releases: onflow/flow-js-testing

Version 0.1.11

15 Jun 22:51
072dc23
Compare
Choose a tag to compare

⭐ Automatic Argument Type Resolver

There is always a room for improvement, that's why we have removed requirement to pass argument type for each and every one of them when you execute script or send transaction. Types are automagically inferred from Cadence code passed for each interaction. So now instead of writing:

const args = [
   [42, 1337, t. Int],
   ["Hello, Cadence", t.String],
   [ "1.001", t.UFix64]
]

you can simply write:

const args = [ 42, 1337, "Hello, Cadence", 1.001]

That's right - no need to pass fixed point values as string - we got you! ;)
Also, if you mess up and pass value of incorrect type mapper would throw an error failing test and notifying you, where you need to make adjustments.

⭐ Automatic Import Resolver

It's possible to omit addressMap field, when submitting interaction to network. Import resolver would try to match the name of the contract to deployed contract thus simplifying the amount of code you write. Let's assume you have Cadence template:

import Kibble from 0x01
import FungibleToken from 0x02

pub fun main(account: Address): UFix64{
    // some logic for extracting the balance from account address here
}

Before you would need to get the address of account where imported contracts are deployed and then pass them in addressMap field:

const Kibble = await getContractAddress("Kibble")
const FungibleToken = await getContractAddress("FungibleToken")

const addressMap = { Kibble, FungibleToken }
const result = await executeScript({ name: "getBalance", args: [ Alice ], addressMap })

Now you can do one-liner!

const result = await executeScript({ name: "getBalance", args: [ Alice ] })

Version 0.1.10

08 Jun 09:06
569f63e
Compare
Choose a tag to compare

Fixed Service Interaction

Last update introduced new build system, which "abruptly" lost Cadence template files for all service interactions. This version aims to fix this issue. We are sorry for the inconvenience 🙇‍♂️

Simplified Interactions

You can now send transactions and execute scripts by specifying their name. No need to deliberately get template code and pass it as argument.

const args = [["0x01", types.Address]]

await sendTransaction({name: "setup-account", args })
await executeScript({ name: "get-balance", args });
// or even easier 
await sendTransaction("setup-account", args)
await executeScript("get-balance", args);

It's still possible to pass Cadence code via code field for backward compatibility.

Adjust Jest assertions

Provided Jest assertions was adjusted to catch errors more reliably. We also exported shallThrow method for cases, when interaction can reject Promise and throw error as well.

Version 0.1.9

22 May 14:50
672807c
Compare
Choose a tag to compare

⭐ Features

Updated Main Path

Using microbundle package to import paths from flow-js-testing instead offlow-js-testing/dist.
⭐ This makes module import easier and more clean.

Promised Emulator

it's possible to start and stop emulator instance programmatically.
⭐ This will allow you to run your test suites in parallel.

Init Port

init method now supports port argument to sync with emulator instance

Jest Assertion

Jest assertion methods - shallPass, shallRevert and shallResolve added

Local Imports

Local imports inside Cadence template files are now supported and will be properly replaced.

🎉 Improvements

  • Updated documentation for all available methods
  • Examples for basic usage and passing metadata as argument

v0.1.2

15 Dec 15:25
Compare
Choose a tag to compare
v0.1.2 Pre-release
Pre-release

This is initial release to unblock development of the tests