|
1 | 1 | import path from "path" |
2 | | -import {init, emulator, getAccountAddress, sendTransaction} from "../src" |
| 2 | +import { |
| 3 | + init, |
| 4 | + emulator, |
| 5 | + getAccountAddress, |
| 6 | + sendTransaction, |
| 7 | + shallPass, |
| 8 | +} from "../src" |
3 | 9 |
|
4 | 10 | beforeEach(async () => { |
5 | 11 | const basePath = path.resolve(__dirname, "./cadence") |
@@ -29,19 +35,18 @@ test("send transaction", async () => { |
29 | 35 |
|
30 | 36 | // There are several ways to call "sendTransaction" |
31 | 37 | // 1. Providing "code" field for Cadence template |
32 | | - const [txInlineResult] = await sendTransaction({code, signers, args}) |
| 38 | + const [txInlineResult] = await shallPass( |
| 39 | + sendTransaction({code, signers, args}) |
| 40 | + ) |
33 | 41 | // 2. Providing "name" field to read Cadence template from file in "./transaction" folder |
34 | | - const [txFileResult] = await sendTransaction({name, signers, args}) |
35 | | - |
36 | | - expect(txInlineResult).toBeTruthy() |
37 | | - expect(txFileResult).toBeTruthy() |
38 | | - expect(txInlineResult.statusCode).toBe(0) |
39 | | - expect(txFileResult.statusCode).toBe(0) |
| 42 | + const [txFileResult] = await shallPass(sendTransaction({name, signers, args})) |
40 | 43 |
|
41 | 44 | // 3. Providing name of the file in short form (name, signers, args) |
42 | | - const [txShortResult] = await sendTransaction(name, signers, args) |
43 | | - expect(txShortResult).toBeTruthy() |
44 | | - expect(txShortResult.statusCode).toBe(0) |
| 45 | + const [txShortResult] = await shallPass(sendTransaction(name, signers, args)) |
| 46 | + |
| 47 | + // Check that all transaction results are the same |
| 48 | + expect(txFileResult).toEqual(txInlineResult) |
| 49 | + expect(txShortResult).toEqual(txInlineResult) |
45 | 50 | }) |
46 | 51 |
|
47 | 52 | afterEach(async () => { |
|
0 commit comments