-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathcontract_example_connectors_test.cdc.tmpl
More file actions
51 lines (44 loc) · 1.45 KB
/
contract_example_connectors_test.cdc.tmpl
File metadata and controls
51 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import Test
import "FungibleToken"
import "FlowToken"
import "ExampleConnectors"
import "DeFiActions"
access(all) let serviceAccount = Test.serviceAccount()
access(all) let recipient = Test.createAccount()
access(all) fun setup() {
// Deploy DeFi Actions dependencies first
// Note: The Cadence Test Framework requires manual deployment of dependencies
// unless used in Fork Testing mode.
var err = Test.deployContract(
name: "DeFiActionsUtils",
path: "../../imports/6d888f175c158410/DeFiActionsUtils.cdc",
arguments: []
)
Test.expect(err, Test.beNil())
err = Test.deployContract(
name: "DeFiActions",
path: "../../imports/6d888f175c158410/DeFiActions.cdc",
arguments: []
)
Test.expect(err, Test.beNil())
// Deploy ExampleConnectors
err = Test.deployContract(
name: "ExampleConnectors",
path: "../contracts/ExampleConnectors.cdc",
arguments: []
)
Test.expect(err, Test.beNil())
}
access(all) fun testTokenSinkDeposit() {
// Execute transaction to test TokenSink
// Service account already has FLOW tokens
let code = Test.readFile("../transactions/DepositViaSink.cdc")
let tx = Test.Transaction(
code: code,
authorizers: [serviceAccount.address],
signers: [serviceAccount],
arguments: [recipient.address, 10.0]
)
let result = Test.executeTransaction(tx)
Test.expect(result, Test.beSucceeded())
}