-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathselector.test.ts
More file actions
101 lines (84 loc) · 3.61 KB
/
selector.test.ts
File metadata and controls
101 lines (84 loc) · 3.61 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { Spec } from '@specron/spec';
interface Data {
selector?: any;
owner?: string;
}
const spec = new Spec<Data>();
spec.beforeEach(async (ctx) => {
const accounts = await ctx.web3.eth.getAccounts();
ctx.set('owner', accounts[0]);
});
spec.beforeEach(async (ctx) => {
const selector = await ctx.deploy({
src: './build/selector.json',
contract: 'Selector',
});
ctx.set('selector', selector);
});
spec.test('checks erc2477 selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', []],
});
const bytes = await selector.instance.methods.calculateERC2477Selector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});
spec.test('checks Xcert selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', []],
});
const bytes = await selector.instance.methods.calculateXcertSelector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});
spec.test('checks mutable Xcert selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', ['0x0d04c3b8']],
});
const bytes = await selector.instance.methods.calculateMutableXcertSelector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});
spec.test('checks destroyable Xcert selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', ['0x9d118770']],
});
const bytes = await selector.instance.methods.calculateDestroyableXcertSelector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});
spec.test('checks revokable Xcert selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', ['0x20c5429b']],
});
const bytes = await selector.instance.methods.calculateRevokableXcertSelector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});
spec.test('checks pausable Xcert selector', async (ctx) => {
const selector = ctx.get('selector');
const xcert = await ctx.deploy({
src: './build/xcert-mock.json',
contract: 'XcertMock',
args: ['Foo', 'F', 'https://0xcert.org/', '.json', '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658', ['0xbedb86fb']],
});
const bytes = await selector.instance.methods.calculatePausableXcertSelector().call();
const supports = await xcert.instance.methods.supportsInterface(bytes).call();
ctx.is(supports, true);
});
export default spec;