forked from onflow/fcl-js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontract.test.js
60 lines (52 loc) · 1.44 KB
/
contract.test.js
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
51
52
53
54
55
56
57
58
59
60
import * as root from "./sdk"
import * as decode from "./decode/decode.js"
import * as encode from "./encode/encode.js"
import * as interaction from "./interaction/interaction.js"
import * as send from "./send/send.js"
import * as template from "@onflow/util-template"
const interfaceContract = (label, wat) => ([template]) => {
const keys = template.replace(/\s+/g, "|").split("|").filter(Boolean)
describe(label, () => {
for (let key of keys)
test(`${label}.${key}`, () =>
expect(wat[key]).toStrictEqual(expect.any(Function)))
})
}
interfaceContract("export", root)`
build resolve send
decode
isOk isBad why pipe
getAccount getEvents getLatestBlock getTransactionStatus
authorizations authorization
params param
proposer payer
ping script transaction
limit ref
resolveAccounts
resolveSignatures
`
describe("consume", () => {
interfaceContract("@onflow/decode", decode)`
decode
decodeResponse
`
interfaceContract("@onflow/encode", encode)`
encodeTransactionPayload
encodeTransactionEnvelope
`
interfaceContract("@onflow/interaction", interaction)`
interaction
pipe Ok isOk isBad why
put get update
makeGetAccount makeGetEvents makeGetLatestBlock
makeGetTransactionStatus makePing
makeScript makeTransaction
isTransaction isScript
`
interfaceContract("@onflow/send", send)`
send
`
interfaceContract("@onflow/util-template", template)`
template
`
})