Skip to content

Commit

Permalink
Update Cadence tests to latest API features (#161)
Browse files Browse the repository at this point in the history
Preliminary work to update the Cadence tests to the upcoming API
features.
Most notable features include the ability to specify deployment
addresses in `flow.json` config file, thus allowing developers to import
the contracts under test, in their tests files. This allows the use of
nested types defined in these contracts. E.g.:

```cadence
let typ = Type<CapabilityDelegator.DelegatorUpdated>()
let events = Test.eventsOfType(typ)
Test.assertEqual(4, events.length)

let event = events[3]! as! CapabilityDelegator.DelegatorUpdated
Test.assert(event.isPublic == false)
Test.assert(event.active == false)

let capabilityType = Type<Capability<&ExampleNFT.Collection{NonFungibleToken.Provider}>>()
Test.assertEqual(capabilityType, event.capabilityType)
```
The above snippet allows performing assertions on events payload.
  • Loading branch information
m-Peter authored Nov 9, 2023
1 parent 8a6faba commit 84bb6f3
Show file tree
Hide file tree
Showing 21 changed files with 1,128 additions and 1,113 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
go-version: 1.18
- name: Install Flow CLI
run: bash -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.4.4
run: bash -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)" -- v1.5.0
- name: Run tests
run: sh ./test.sh
- name: Normalize coverage report filepaths
Expand Down
Loading

0 comments on commit 84bb6f3

Please sign in to comment.