forked from mechanismHQ/bns-x
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextensions_test.ts
49 lines (41 loc) · 1.28 KB
/
extensions_test.ts
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
import {
beforeAll,
deployWithNamespace,
describe,
it,
assertEquals,
asciiToBytes,
alice,
utilsRegisterBtc,
deployer,
bytesToAscii,
bob,
bns,
registry,
} from "./helpers.ts";
import { btcBytes } from "./mocks.ts";
import { contracts, testUtils } from "./clarigen.ts";
import { assert, txOk } from "../deps.ts";
import { allNamespacesRaw, registerNameV1 } from "./bns-helpers.ts";
const extensions = contracts.bnsxExtensions;
const bootstrap = contracts.proposalBootstrap;
describe("bnsx-extensions", () => {
const { chain } = deployWithNamespace();
it("proposal-bootstrap is executed", () => {
const executedAt = chain.rov(extensions.executedAt(bootstrap.identifier));
assert(executedAt !== null);
});
it("deployer can set extension manually", () => {
const fakePrincipal = `${deployer}.fake`;
const receipt = chain.txOk(
extensions.setExtensions([{ extension: fakePrincipal, enabled: true }]),
deployer
);
assertEquals(chain.rov(extensions.isExtension(fakePrincipal)), true);
});
it("can execute additional proposal", () => {
const proposal = contracts.proposal2.identifier;
chain.txOk(extensions.execute(proposal, deployer), deployer);
assertEquals(chain.rov(extensions.isExtension(deployer)), false);
});
});