-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsystem.test.ts
More file actions
56 lines (48 loc) · 1.67 KB
/
system.test.ts
File metadata and controls
56 lines (48 loc) · 1.67 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
51
52
53
54
55
56
import { Account } from "../src/account";
import { expectBalance } from "../src/assertion";
import { Chain } from "../src/chain";
import { Contract } from "../src/contract";
import { generateTapos } from "../src/utils";
import { TESTING_PUBLIC_KEY } from "../src/wallet";
describe("account test", () => {
let chain: Chain;
let account: Account;
let chainName = process.env.CHAIN_NAME || "WAX";
beforeAll(async () => {
chain = await Chain.setupChain(chainName);
account = await chain.system.createAccount("testaccount1");
}, 60000);
afterAll(async () => {
await chain.clear();
}, 10000);
describe("test createAccount", function () {
it("should created 10 test accounts", async () => {
const test12 = await chain.system.createAccount("test12");
expect(test12).toHaveProperty("name");
});
});
describe("test createAccounts", function () {
it("should created 10 test accounts", async () => {
for (let i = 0; i < 10; i++) {
let testAccount = chain.accounts[i];
expect(testAccount).toHaveProperty("name");
}
for (let i = 10; i < 20; i++) {
let testAccount = chain.accounts[i];
expect(testAccount).toBeUndefined;
}
});
});
describe("test loadAccount", function () {
it("test load an existing contract", async () => {
const eosio = await chain.system.fromAccount("eosio");
expect(eosio).toHaveProperty("name");
expect(eosio).toHaveProperty("contract");
}, 100000);
it("should not load non existing account", async () => {
await expect(chain.system.fromAccount("eosio123")).rejects.toThrowError(
"unknown key"
);
}, 100000);
});
});