@graphprotocol/graph-cli 0.64.0 → 0.64.1-alpha-20231218145603-ee88ea0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/codegen/schema.test.js +29 -28
- package/dist/codegen/types/index.test.js +431 -430
- package/dist/codegen/util.test.js +11 -10
- package/dist/command-helpers/abi.test.js +4 -3
- package/dist/command-helpers/compiler.test.js +16 -15
- package/dist/command-helpers/network.test.js +16 -15
- package/dist/command-helpers/scaffold.d.ts +10 -10
- package/dist/command-helpers/scaffold.js +5 -5
- package/dist/command-helpers/version.test.js +45 -52
- package/dist/protocols/ethereum/codegen/abi.test.js +33 -32
- package/dist/protocols/ethereum/type-generator.js +3 -3
- package/dist/scaffold/cosmos.test.js +8 -7
- package/dist/scaffold/ethereum.test.js +20 -19
- package/dist/scaffold/index.d.ts +21 -21
- package/dist/scaffold/index.js +31 -30
- package/dist/scaffold/near.test.js +8 -7
- package/dist/scaffold/tests.d.ts +3 -3
- package/dist/scaffold/tests.js +3 -3
- package/dist/type-generator.js +2 -2
- package/dist/validation/schema.test.js +26 -25
- package/oclif.manifest.json +1 -1
- package/package.json +8 -9
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
3
4
|
const util_1 = require("./util");
|
|
4
|
-
describe('Codegen utilities', () => {
|
|
5
|
-
test('Name disambiguation', () => {
|
|
6
|
-
expect((0, util_1.disambiguateNames)({
|
|
5
|
+
vitest_1.describe.concurrent('Codegen utilities', () => {
|
|
6
|
+
(0, vitest_1.test)('Name disambiguation', () => {
|
|
7
|
+
(0, vitest_1.expect)((0, util_1.disambiguateNames)({
|
|
7
8
|
values: ['a', 'b', 'c'],
|
|
8
9
|
getName: x => x,
|
|
9
10
|
setName: (_x, name) => name,
|
|
10
11
|
})).toEqual(['a', 'b', 'c']);
|
|
11
|
-
expect((0, util_1.disambiguateNames)({
|
|
12
|
+
(0, vitest_1.expect)((0, util_1.disambiguateNames)({
|
|
12
13
|
values: ['a', 'a', 'a'],
|
|
13
14
|
getName: x => x,
|
|
14
15
|
setName: (_x, name) => name,
|
|
15
16
|
})).toEqual(['a', 'a1', 'a2']);
|
|
16
|
-
expect((0, util_1.disambiguateNames)({
|
|
17
|
+
(0, vitest_1.expect)((0, util_1.disambiguateNames)({
|
|
17
18
|
values: [
|
|
18
19
|
{ name: 'ExampleEvent', inputs: [] },
|
|
19
20
|
{ name: 'ExampleEvent', inputs: [{ type: 'uint256' }] },
|
|
@@ -30,13 +31,13 @@ describe('Codegen utilities', () => {
|
|
|
30
31
|
{ name: 'ExampleEvent2', inputs: [{ type: 'uint96' }] },
|
|
31
32
|
]);
|
|
32
33
|
});
|
|
33
|
-
test('Tuple unrolling', () => {
|
|
34
|
-
expect((0, util_1.unrollTuple)({
|
|
34
|
+
(0, vitest_1.test)('Tuple unrolling', () => {
|
|
35
|
+
(0, vitest_1.expect)((0, util_1.unrollTuple)({
|
|
35
36
|
value: { type: 'tuple', name: 'value', components: [] },
|
|
36
37
|
path: ['value'],
|
|
37
38
|
index: 0,
|
|
38
39
|
})).toEqual([]);
|
|
39
|
-
expect((0, util_1.unrollTuple)({
|
|
40
|
+
(0, vitest_1.expect)((0, util_1.unrollTuple)({
|
|
40
41
|
value: {
|
|
41
42
|
type: 'tuple',
|
|
42
43
|
name: 'value',
|
|
@@ -45,7 +46,7 @@ describe('Codegen utilities', () => {
|
|
|
45
46
|
path: ['value'],
|
|
46
47
|
index: 0,
|
|
47
48
|
})).toEqual([{ path: ['value', 'a'], type: 'string' }]);
|
|
48
|
-
expect((0, util_1.unrollTuple)({
|
|
49
|
+
(0, vitest_1.expect)((0, util_1.unrollTuple)({
|
|
49
50
|
value: {
|
|
50
51
|
type: 'tuple',
|
|
51
52
|
name: 'value',
|
|
@@ -60,7 +61,7 @@ describe('Codegen utilities', () => {
|
|
|
60
61
|
{ path: ['value', 'a'], type: 'string' },
|
|
61
62
|
{ path: ['value', 'b'], type: 'uint256' },
|
|
62
63
|
]);
|
|
63
|
-
expect((0, util_1.unrollTuple)({
|
|
64
|
+
(0, vitest_1.expect)((0, util_1.unrollTuple)({
|
|
64
65
|
value: {
|
|
65
66
|
type: 'tuple',
|
|
66
67
|
name: 'value',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
3
4
|
const abi_1 = require("./abi");
|
|
4
5
|
// An object with some test cases for contract deployment block numbers
|
|
5
6
|
const TEST_CONTRACT_START_BLOCKS = {
|
|
@@ -82,13 +83,13 @@ const TEST_CONTRACT_START_BLOCKS = {
|
|
|
82
83
|
// },
|
|
83
84
|
};
|
|
84
85
|
// skip this test since its time consuming
|
|
85
|
-
describe.skip('getStartBlockForContract', () => {
|
|
86
|
+
vitest_1.describe.skip('getStartBlockForContract', () => {
|
|
86
87
|
for (const [network, contracts] of Object.entries(TEST_CONTRACT_START_BLOCKS)) {
|
|
87
88
|
for (const [contract, startBlockExp] of Object.entries(contracts)) {
|
|
88
|
-
test(`Returns the start block ${network} ${contract} ${startBlockExp}`, async () => {
|
|
89
|
+
(0, vitest_1.test)(`Returns the start block ${network} ${contract} ${startBlockExp}`, async () => {
|
|
89
90
|
//loop through the TEST_CONTRACT_START_BLOCKS object and test each network
|
|
90
91
|
const startBlock = await (0, abi_1.getStartBlockForContract)(network, contract);
|
|
91
|
-
expect(startBlock).toBe(startBlockExp);
|
|
92
|
+
(0, vitest_1.expect)(startBlock).toBe(startBlockExp);
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
3
4
|
const compiler_1 = require("./compiler");
|
|
4
|
-
describe('appendApiVersionForGraph', () => {
|
|
5
|
-
it('append /api/v0 to Prod URL with trailing slash', () => {
|
|
6
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs/')).toBe('https://api.thegraph.com/ipfs/api/v0');
|
|
5
|
+
vitest_1.describe.concurrent('appendApiVersionForGraph', () => {
|
|
6
|
+
(0, vitest_1.it)('append /api/v0 to Prod URL with trailing slash', () => {
|
|
7
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs/')).toBe('https://api.thegraph.com/ipfs/api/v0');
|
|
7
8
|
});
|
|
8
|
-
it('append /api/v0 to Prod URL without trailing slash', () => {
|
|
9
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs')).toBe('https://api.thegraph.com/ipfs/api/v0');
|
|
9
|
+
(0, vitest_1.it)('append /api/v0 to Prod URL without trailing slash', () => {
|
|
10
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs')).toBe('https://api.thegraph.com/ipfs/api/v0');
|
|
10
11
|
});
|
|
11
|
-
it('append /api/v0 to Staging URL without trailing slash', () => {
|
|
12
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://staging.api.thegraph.com/ipfs')).toBe('https://staging.api.thegraph.com/ipfs/api/v0');
|
|
12
|
+
(0, vitest_1.it)('append /api/v0 to Staging URL without trailing slash', () => {
|
|
13
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://staging.api.thegraph.com/ipfs')).toBe('https://staging.api.thegraph.com/ipfs/api/v0');
|
|
13
14
|
});
|
|
14
|
-
it('do nothing if Prod URL has /api/v0', () => {
|
|
15
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs/api/v0')).toBe('https://api.thegraph.com/ipfs/api/v0');
|
|
15
|
+
(0, vitest_1.it)('do nothing if Prod URL has /api/v0', () => {
|
|
16
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs/api/v0')).toBe('https://api.thegraph.com/ipfs/api/v0');
|
|
16
17
|
});
|
|
17
|
-
it('do nothing if Prod URL has no /ipfs', () => {
|
|
18
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com')).toBe('https://api.thegraph.com');
|
|
18
|
+
(0, vitest_1.it)('do nothing if Prod URL has no /ipfs', () => {
|
|
19
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com')).toBe('https://api.thegraph.com');
|
|
19
20
|
});
|
|
20
|
-
it('do nothing for non-graph endpoint', () => {
|
|
21
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://ipfs.saihaj.dev/')).toBe('https://ipfs.saihaj.dev/');
|
|
21
|
+
(0, vitest_1.it)('do nothing for non-graph endpoint', () => {
|
|
22
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://ipfs.saihaj.dev/')).toBe('https://ipfs.saihaj.dev/');
|
|
22
23
|
});
|
|
23
|
-
it('do nothing for non-graph endpoint ending with /ipfs', () => {
|
|
24
|
-
expect((0, compiler_1.appendApiVersionForGraph)('https://ipfs.saihaj.dev/ipfs/')).toBe('https://ipfs.saihaj.dev/ipfs/');
|
|
24
|
+
(0, vitest_1.it)('do nothing for non-graph endpoint ending with /ipfs', () => {
|
|
25
|
+
(0, vitest_1.expect)((0, compiler_1.appendApiVersionForGraph)('https://ipfs.saihaj.dev/ipfs/')).toBe('https://ipfs.saihaj.dev/ipfs/');
|
|
25
26
|
});
|
|
26
27
|
});
|
|
@@ -28,20 +28,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const path_1 = __importDefault(require("path"));
|
|
30
30
|
const toolbox = __importStar(require("gluegun"));
|
|
31
|
+
const vitest_1 = require("vitest");
|
|
31
32
|
const yaml_1 = __importDefault(require("yaml"));
|
|
32
33
|
const network_1 = require("./network");
|
|
33
34
|
const SUBGRAPH_PATH_BASE = path_1.default.join(__dirname, '..', '..', '..', '..', 'examples', 'example-subgraph');
|
|
34
|
-
describe('initNetworksConfig', () => {
|
|
35
|
-
beforeAll(async () => {
|
|
35
|
+
vitest_1.describe.concurrent('initNetworksConfig', () => {
|
|
36
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
36
37
|
await (0, network_1.initNetworksConfig)(SUBGRAPH_PATH_BASE, 'address');
|
|
37
38
|
});
|
|
38
|
-
afterAll(async () => {
|
|
39
|
+
(0, vitest_1.afterAll)(async () => {
|
|
39
40
|
toolbox.filesystem.remove(`${SUBGRAPH_PATH_BASE}/networks.json`);
|
|
40
41
|
});
|
|
41
|
-
test('generates networks.json from subgraph.yaml', () => {
|
|
42
|
-
expect(toolbox.filesystem.exists(`${SUBGRAPH_PATH_BASE}/networks.json`)).toBe('file');
|
|
42
|
+
(0, vitest_1.test)('generates networks.json from subgraph.yaml', () => {
|
|
43
|
+
(0, vitest_1.expect)(toolbox.filesystem.exists(`${SUBGRAPH_PATH_BASE}/networks.json`)).toBe('file');
|
|
43
44
|
});
|
|
44
|
-
test('Populates the networks.json file with the data from subgraph.yaml', async () => {
|
|
45
|
+
(0, vitest_1.test)('Populates the networks.json file with the data from subgraph.yaml', async () => {
|
|
45
46
|
const networksStr = toolbox.filesystem.read(`${SUBGRAPH_PATH_BASE}/networks.json`);
|
|
46
47
|
const networks = JSON.parse(networksStr);
|
|
47
48
|
const expected = {
|
|
@@ -49,11 +50,11 @@ describe('initNetworksConfig', () => {
|
|
|
49
50
|
ExampleSubgraph: { address: '0x22843e74c59580b3eaf6c233fa67d8b7c561a835' },
|
|
50
51
|
},
|
|
51
52
|
};
|
|
52
|
-
expect(networks).toStrictEqual(expected);
|
|
53
|
+
(0, vitest_1.expect)(networks).toStrictEqual(expected);
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
|
-
describe('updateSubgraphNetwork', () => {
|
|
56
|
-
beforeAll(async () => {
|
|
56
|
+
vitest_1.describe.concurrent('updateSubgraphNetwork', () => {
|
|
57
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
57
58
|
const content = {
|
|
58
59
|
optimism: {
|
|
59
60
|
ExampleSubgraph: { address: '0x12345...' },
|
|
@@ -62,25 +63,25 @@ describe('updateSubgraphNetwork', () => {
|
|
|
62
63
|
toolbox.filesystem.write(`${SUBGRAPH_PATH_BASE}/networks.json`, content);
|
|
63
64
|
toolbox.filesystem.copy(`${SUBGRAPH_PATH_BASE}/subgraph.yaml`, `${SUBGRAPH_PATH_BASE}/subgraph_copy.yaml`);
|
|
64
65
|
});
|
|
65
|
-
afterAll(async () => {
|
|
66
|
+
(0, vitest_1.afterAll)(async () => {
|
|
66
67
|
toolbox.filesystem.remove(`${SUBGRAPH_PATH_BASE}/networks.json`);
|
|
67
68
|
toolbox.filesystem.remove(`${SUBGRAPH_PATH_BASE}/subgraph_copy.yaml`);
|
|
68
69
|
});
|
|
69
|
-
test('Updates subgraph.yaml', async () => {
|
|
70
|
+
(0, vitest_1.test)('Updates subgraph.yaml', async () => {
|
|
70
71
|
const manifest = `${SUBGRAPH_PATH_BASE}/subgraph_copy.yaml`;
|
|
71
72
|
const networksFie = `${SUBGRAPH_PATH_BASE}/networks.json`;
|
|
72
73
|
let subgraph = toolbox.filesystem.read(manifest);
|
|
73
74
|
let subgraphObj = yaml_1.default.parse(subgraph);
|
|
74
75
|
let network = subgraphObj.dataSources[0].network;
|
|
75
76
|
let address = subgraphObj.dataSources[0].source.address;
|
|
76
|
-
expect(network).toBe('mainnet');
|
|
77
|
-
expect(address).toBe('0x22843e74c59580b3eaf6c233fa67d8b7c561a835');
|
|
77
|
+
(0, vitest_1.expect)(network).toBe('mainnet');
|
|
78
|
+
(0, vitest_1.expect)(address).toBe('0x22843e74c59580b3eaf6c233fa67d8b7c561a835');
|
|
78
79
|
await (0, network_1.updateSubgraphNetwork)(manifest, 'optimism', networksFie, 'address');
|
|
79
80
|
subgraph = toolbox.filesystem.read(manifest);
|
|
80
81
|
subgraphObj = yaml_1.default.parse(subgraph);
|
|
81
82
|
network = subgraphObj.dataSources[0].network;
|
|
82
83
|
address = subgraphObj.dataSources[0].source.address;
|
|
83
|
-
expect(network).toBe('optimism');
|
|
84
|
-
expect(address).toBe('0x12345...');
|
|
84
|
+
(0, vitest_1.expect)(network).toBe('optimism');
|
|
85
|
+
(0, vitest_1.expect)(address).toBe('0x12345...');
|
|
85
86
|
});
|
|
86
87
|
});
|
|
@@ -15,26 +15,26 @@ export declare const generateScaffold: ({ protocolInstance, abi, contract, netwo
|
|
|
15
15
|
node?: string | undefined;
|
|
16
16
|
spkgPath?: string | undefined;
|
|
17
17
|
}, spinner: Spinner) => Promise<{
|
|
18
|
-
'subgraph.yaml':
|
|
19
|
-
'schema.graphql':
|
|
20
|
-
'package.json':
|
|
18
|
+
'subgraph.yaml': string;
|
|
19
|
+
'schema.graphql': string;
|
|
20
|
+
'package.json': string;
|
|
21
21
|
'tsconfig.json'?: undefined;
|
|
22
22
|
src?: undefined;
|
|
23
23
|
abis?: undefined;
|
|
24
24
|
tests?: undefined;
|
|
25
25
|
} | {
|
|
26
|
-
'package.json':
|
|
27
|
-
'subgraph.yaml':
|
|
28
|
-
'schema.graphql':
|
|
29
|
-
'tsconfig.json':
|
|
26
|
+
'package.json': string;
|
|
27
|
+
'subgraph.yaml': string;
|
|
28
|
+
'schema.graphql': string;
|
|
29
|
+
'tsconfig.json': string;
|
|
30
30
|
src: {
|
|
31
|
-
[x: string]:
|
|
31
|
+
[x: string]: string;
|
|
32
32
|
} | undefined;
|
|
33
33
|
abis: {
|
|
34
|
-
[x: string]:
|
|
34
|
+
[x: string]: string;
|
|
35
35
|
} | undefined;
|
|
36
36
|
tests: {
|
|
37
|
-
[x: string]:
|
|
37
|
+
[x: string]: string;
|
|
38
38
|
} | undefined;
|
|
39
39
|
}>;
|
|
40
40
|
export declare const writeScaffold: (scaffold: any, directory: string, spinner: Spinner) => Promise<void>;
|
|
@@ -42,7 +42,7 @@ const generateScaffold = async ({ protocolInstance, abi, contract, network, subg
|
|
|
42
42
|
node,
|
|
43
43
|
spkgPath,
|
|
44
44
|
});
|
|
45
|
-
return scaffold.generate();
|
|
45
|
+
return await scaffold.generate();
|
|
46
46
|
};
|
|
47
47
|
exports.generateScaffold = generateScaffold;
|
|
48
48
|
const writeScaffoldDirectory = async (scaffold, directory, spinner) => {
|
|
@@ -70,7 +70,7 @@ const writeScaffold = async (scaffold, directory, spinner) => {
|
|
|
70
70
|
};
|
|
71
71
|
exports.writeScaffold = writeScaffold;
|
|
72
72
|
const writeABI = async (abi, contractName) => {
|
|
73
|
-
const data = prettier_1.default.format(JSON.stringify(abi.data), {
|
|
73
|
+
const data = await prettier_1.default.format(JSON.stringify(abi.data), {
|
|
74
74
|
parser: 'json',
|
|
75
75
|
});
|
|
76
76
|
await fs_extra_1.default.writeFile(`./abis/${contractName}.json`, data, 'utf-8');
|
|
@@ -82,7 +82,7 @@ const writeSchema = async (abi, protocol, schemaPath, entities, contractName) =>
|
|
|
82
82
|
.filter(event => !entities.includes(event.get('name')))
|
|
83
83
|
.toJS()
|
|
84
84
|
: [];
|
|
85
|
-
const data = prettier_1.default.format(events.map(event => (0, schema_1.generateEventType)(event, protocol.name, contractName)).join('\n\n'), {
|
|
85
|
+
const data = await prettier_1.default.format(events.map(event => (0, schema_1.generateEventType)(event, protocol.name, contractName)).join('\n\n'), {
|
|
86
86
|
parser: 'graphql',
|
|
87
87
|
});
|
|
88
88
|
await fs_extra_1.default.appendFile(schemaPath, data, { encoding: 'utf-8' });
|
|
@@ -94,7 +94,7 @@ const writeMapping = async (abi, protocol, contractName, entities) => {
|
|
|
94
94
|
.filter(event => !entities.includes(event.get('name')))
|
|
95
95
|
.toJS()
|
|
96
96
|
: [];
|
|
97
|
-
const mapping = prettier_1.default.format((0, mapping_1.generateEventIndexingHandlers)(events, contractName), {
|
|
97
|
+
const mapping = await prettier_1.default.format((0, mapping_1.generateEventIndexingHandlers)(events, contractName), {
|
|
98
98
|
parser: 'typescript',
|
|
99
99
|
semi: false,
|
|
100
100
|
});
|
|
@@ -107,7 +107,7 @@ const writeTestsFiles = async (abi, protocol, contractName) => {
|
|
|
107
107
|
if (events.length > 0) {
|
|
108
108
|
// If a contract is added to a subgraph that has no tests folder
|
|
109
109
|
await fs_extra_1.default.ensureDir('./tests/');
|
|
110
|
-
const testsFiles = (0, tests_1.generateTestsFiles)(contractName, events, true);
|
|
110
|
+
const testsFiles = await (0, tests_1.generateTestsFiles)(contractName, events, true);
|
|
111
111
|
for (const [fileName, content] of Object.entries(testsFiles)) {
|
|
112
112
|
await fs_extra_1.default.writeFile(`./tests/${fileName}`, content, 'utf-8');
|
|
113
113
|
}
|
|
@@ -23,53 +23,53 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const
|
|
26
|
+
const vitest_1 = require("vitest");
|
|
27
|
+
const loadManifestUtils = __importStar(require("../migrations/util/load-manifest"));
|
|
27
28
|
const graphTsUtil = __importStar(require("../migrations/util/versions"));
|
|
28
29
|
const version_1 = require("./version");
|
|
29
|
-
describe('Version Command Helpers', () => {
|
|
30
|
-
|
|
30
|
+
vitest_1.describe.concurrent('Version Command Helpers', () => {
|
|
31
|
+
(0, vitest_1.beforeEach)(() => {
|
|
32
|
+
vitest_1.vi.resetModules();
|
|
33
|
+
});
|
|
34
|
+
(0, vitest_1.describe)('assertManifestApiVersion', () => {
|
|
31
35
|
const fakeManifestPath = 'fake/manifest/path';
|
|
32
36
|
const minimumApiVersion = '0.0.5';
|
|
33
|
-
describe('With just dataSources', () => {
|
|
34
|
-
test('When all of them are less than minimum apiVersion', async () => {
|
|
35
|
-
|
|
36
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
37
|
+
(0, vitest_1.describe)('With just dataSources', () => {
|
|
38
|
+
(0, vitest_1.test)('When all of them are less than minimum apiVersion', async () => {
|
|
39
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
37
40
|
dataSources: [
|
|
38
41
|
{ mapping: { apiVersion: '0.0.1' } },
|
|
39
42
|
{ mapping: { apiVersion: '0.0.2' } },
|
|
40
43
|
{ mapping: { apiVersion: '0.0.3' } },
|
|
41
44
|
],
|
|
42
45
|
}));
|
|
43
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
46
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
44
47
|
});
|
|
45
|
-
test('When one of them is less than minimum apiVersion', async () => {
|
|
46
|
-
|
|
47
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
48
|
+
(0, vitest_1.test)('When one of them is less than minimum apiVersion', async () => {
|
|
49
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
48
50
|
dataSources: [
|
|
49
51
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
50
52
|
{ mapping: { apiVersion: '0.0.2' } },
|
|
51
53
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
52
54
|
],
|
|
53
55
|
}));
|
|
54
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
56
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
55
57
|
});
|
|
56
|
-
test('When none of them are less than minimum apiVersion', async () => {
|
|
57
|
-
|
|
58
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
58
|
+
(0, vitest_1.test)('When none of them are less than minimum apiVersion', async () => {
|
|
59
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
59
60
|
dataSources: [
|
|
60
61
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
61
62
|
{ mapping: { apiVersion: '0.0.6' } },
|
|
62
63
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
63
64
|
],
|
|
64
65
|
}));
|
|
65
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).resolves.toBe(undefined);
|
|
66
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).resolves.toBe(undefined);
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
|
-
describe('With dataSources and templates', () => {
|
|
69
|
-
describe('And the dataSources have a lower apiVersion', () => {
|
|
70
|
-
test('When all of the templates are less than minimum apiVersion', async () => {
|
|
71
|
-
|
|
72
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
69
|
+
(0, vitest_1.describe)('With dataSources and templates', () => {
|
|
70
|
+
(0, vitest_1.describe)('And the dataSources have a lower apiVersion', () => {
|
|
71
|
+
(0, vitest_1.test)('When all of the templates are less than minimum apiVersion', async () => {
|
|
72
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
73
73
|
dataSources: [
|
|
74
74
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
75
75
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
@@ -81,11 +81,10 @@ describe('Version Command Helpers', () => {
|
|
|
81
81
|
{ mapping: { apiVersion: '0.0.3' } },
|
|
82
82
|
],
|
|
83
83
|
}));
|
|
84
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
84
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
85
85
|
});
|
|
86
|
-
test('When one of the templates is less than minimum apiVersion', async () => {
|
|
87
|
-
|
|
88
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
86
|
+
(0, vitest_1.test)('When one of the templates is less than minimum apiVersion', async () => {
|
|
87
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
89
88
|
dataSources: [
|
|
90
89
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
91
90
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
@@ -97,11 +96,10 @@ describe('Version Command Helpers', () => {
|
|
|
97
96
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
98
97
|
],
|
|
99
98
|
}));
|
|
100
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
99
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
101
100
|
});
|
|
102
|
-
test('When none of the templates are less than minimum apiVersion', async () => {
|
|
103
|
-
|
|
104
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
101
|
+
(0, vitest_1.test)('When none of the templates are less than minimum apiVersion', async () => {
|
|
102
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
105
103
|
dataSources: [
|
|
106
104
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
107
105
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
@@ -113,13 +111,12 @@ describe('Version Command Helpers', () => {
|
|
|
113
111
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
114
112
|
],
|
|
115
113
|
}));
|
|
116
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
114
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
117
115
|
});
|
|
118
116
|
});
|
|
119
|
-
describe('And the dataSources do NOT have a lower apiVersion', () => {
|
|
120
|
-
test('When all of the templates are less than minimum apiVersion', async () => {
|
|
121
|
-
|
|
122
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
117
|
+
(0, vitest_1.describe)('And the dataSources do NOT have a lower apiVersion', () => {
|
|
118
|
+
(0, vitest_1.test)('When all of the templates are less than minimum apiVersion', async () => {
|
|
119
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
123
120
|
dataSources: [
|
|
124
121
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
125
122
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
@@ -131,11 +128,10 @@ describe('Version Command Helpers', () => {
|
|
|
131
128
|
{ mapping: { apiVersion: '0.0.3' } },
|
|
132
129
|
],
|
|
133
130
|
}));
|
|
134
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
131
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
135
132
|
});
|
|
136
|
-
test('When one of the templates is less than minimum apiVersion', async () => {
|
|
137
|
-
|
|
138
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
133
|
+
(0, vitest_1.test)('When one of the templates is less than minimum apiVersion', async () => {
|
|
134
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
139
135
|
dataSources: [
|
|
140
136
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
141
137
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
@@ -147,11 +143,10 @@ describe('Version Command Helpers', () => {
|
|
|
147
143
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
148
144
|
],
|
|
149
145
|
}));
|
|
150
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
146
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).rejects.toThrow(new Error(`The current version of graph-cli can't be used with mappings on apiVersion less than '${minimumApiVersion}'`));
|
|
151
147
|
});
|
|
152
|
-
test('When none of the templates are less than minimum apiVersion', async () => {
|
|
153
|
-
|
|
154
|
-
loadManifestUtil.loadManifest = jest.fn().mockImplementation(() => Promise.resolve({
|
|
148
|
+
(0, vitest_1.test)('When none of the templates are less than minimum apiVersion', async () => {
|
|
149
|
+
vitest_1.vi.spyOn(loadManifestUtils, 'loadManifest').mockImplementation(() => Promise.resolve({
|
|
155
150
|
dataSources: [
|
|
156
151
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
157
152
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
@@ -163,24 +158,22 @@ describe('Version Command Helpers', () => {
|
|
|
163
158
|
{ mapping: { apiVersion: '0.0.5' } },
|
|
164
159
|
],
|
|
165
160
|
}));
|
|
166
|
-
await expect((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).resolves.toBe(undefined);
|
|
161
|
+
await (0, vitest_1.expect)((0, version_1.assertManifestApiVersion)(fakeManifestPath, minimumApiVersion)).resolves.toBe(undefined);
|
|
167
162
|
});
|
|
168
163
|
});
|
|
169
164
|
});
|
|
170
165
|
});
|
|
171
|
-
describe('assertGraphTsVersion', () => {
|
|
166
|
+
(0, vitest_1.describe)('assertGraphTsVersion', () => {
|
|
172
167
|
const fakeNodeModulesDir = 'fake/path/to/node/modules';
|
|
173
168
|
const minimumGraphTsVersion = '0.22.0';
|
|
174
|
-
test("When the installed graph-ts version is less than what's supported", async () => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
await expect((0, version_1.assertGraphTsVersion)(fakeNodeModulesDir, minimumGraphTsVersion)).rejects.toThrow(new Error(`To use this version of the graph-cli you must upgrade the graph-ts dependency to a version greater than or equal to ${minimumGraphTsVersion}
|
|
169
|
+
(0, vitest_1.test)("When the installed graph-ts version is less than what's supported", async () => {
|
|
170
|
+
vitest_1.vi.spyOn(graphTsUtil, 'getGraphTsVersion').mockImplementation(() => Promise.resolve('0.19.0'));
|
|
171
|
+
await (0, vitest_1.expect)((0, version_1.assertGraphTsVersion)(fakeNodeModulesDir, minimumGraphTsVersion)).rejects.toThrow(new Error(`To use this version of the graph-cli you must upgrade the graph-ts dependency to a version greater than or equal to ${minimumGraphTsVersion}
|
|
178
172
|
Also, you'll probably need to take a look at our AssemblyScript migration guide because of language breaking changes: https://thegraph.com/docs/developer/assemblyscript-migration-guide`));
|
|
179
173
|
});
|
|
180
|
-
test('When the installed graph-ts version is a supported one', async () => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
await expect((0, version_1.assertGraphTsVersion)(fakeNodeModulesDir, minimumGraphTsVersion)).resolves.toBe(undefined);
|
|
174
|
+
(0, vitest_1.test)('When the installed graph-ts version is a supported one', async () => {
|
|
175
|
+
vitest_1.vi.spyOn(graphTsUtil, 'getGraphTsVersion').mockImplementation(() => Promise.resolve('0.22.0'));
|
|
176
|
+
await (0, vitest_1.expect)((0, version_1.assertGraphTsVersion)(fakeNodeModulesDir, minimumGraphTsVersion)).resolves.toBe(undefined);
|
|
184
177
|
});
|
|
185
178
|
});
|
|
186
179
|
});
|
|
@@ -29,14 +29,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const path_1 = __importDefault(require("path"));
|
|
30
30
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
31
31
|
const immutable_1 = __importDefault(require("immutable"));
|
|
32
|
+
const vitest_1 = require("vitest");
|
|
32
33
|
const ts = __importStar(require("../../../codegen/typescript"));
|
|
33
34
|
const abi_1 = __importDefault(require("../abi"));
|
|
34
35
|
const abi_2 = __importDefault(require("./abi"));
|
|
35
36
|
let tempdir;
|
|
36
37
|
let abi;
|
|
37
38
|
let generatedTypes;
|
|
38
|
-
describe('ABI code generation', () => {
|
|
39
|
-
beforeAll(async () => {
|
|
39
|
+
vitest_1.describe.concurrent('ABI code generation', () => {
|
|
40
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
40
41
|
tempdir = await fs_extra_1.default.mkdtemp('abi-codegen');
|
|
41
42
|
try {
|
|
42
43
|
const filename = path_1.default.join(tempdir, 'ABI.json');
|
|
@@ -194,12 +195,12 @@ describe('ABI code generation', () => {
|
|
|
194
195
|
await fs_extra_1.default.remove(tempdir);
|
|
195
196
|
}
|
|
196
197
|
});
|
|
197
|
-
afterAll(async () => {
|
|
198
|
+
(0, vitest_1.afterAll)(async () => {
|
|
198
199
|
await fs_extra_1.default.remove(tempdir);
|
|
199
200
|
});
|
|
200
|
-
describe('Generated types', () => {
|
|
201
|
-
test('All expected types are generated', () => {
|
|
202
|
-
expect(generatedTypes.map(type => type.name)).toEqual([
|
|
201
|
+
(0, vitest_1.describe)('Generated types', () => {
|
|
202
|
+
(0, vitest_1.test)('All expected types are generated', () => {
|
|
203
|
+
(0, vitest_1.expect)(generatedTypes.map(type => type.name)).toEqual([
|
|
203
204
|
'Contract__getProposalResultValue0Struct',
|
|
204
205
|
'Contract__getProposalInputParam1Struct',
|
|
205
206
|
'Contract__getProposalInputParam1BarStruct',
|
|
@@ -209,27 +210,27 @@ describe('ABI code generation', () => {
|
|
|
209
210
|
]);
|
|
210
211
|
});
|
|
211
212
|
});
|
|
212
|
-
describe('Contract class', () => {
|
|
213
|
-
test('Exists', () => {
|
|
214
|
-
expect(generatedTypes.find(type => type.name === 'Contract')).toBeDefined();
|
|
213
|
+
(0, vitest_1.describe)('Contract class', () => {
|
|
214
|
+
(0, vitest_1.test)('Exists', () => {
|
|
215
|
+
(0, vitest_1.expect)(generatedTypes.find(type => type.name === 'Contract')).toBeDefined();
|
|
215
216
|
});
|
|
216
|
-
test('Has methods', () => {
|
|
217
|
+
(0, vitest_1.test)('Has methods', () => {
|
|
217
218
|
const contract = generatedTypes.find(type => type.name === 'Contract');
|
|
218
|
-
expect(contract.methods).toBeInstanceOf(Array);
|
|
219
|
+
(0, vitest_1.expect)(contract.methods).toBeInstanceOf(Array);
|
|
219
220
|
});
|
|
220
|
-
test('Has `bind` method', () => {
|
|
221
|
+
(0, vitest_1.test)('Has `bind` method', () => {
|
|
221
222
|
const contract = generatedTypes.find(type => type.name === 'Contract');
|
|
222
|
-
expect(contract.methods.find((method) => method.name === 'bind')).toBeDefined();
|
|
223
|
+
(0, vitest_1.expect)(contract.methods.find((method) => method.name === 'bind')).toBeDefined();
|
|
223
224
|
});
|
|
224
|
-
test('Has methods for all callable functions', () => {
|
|
225
|
+
(0, vitest_1.test)('Has methods for all callable functions', () => {
|
|
225
226
|
const contract = generatedTypes.find(type => type.name === 'Contract');
|
|
226
|
-
expect(contract.methods.map((method) => method.name)).toContain('getProposal');
|
|
227
|
+
(0, vitest_1.expect)(contract.methods.map((method) => method.name)).toContain('getProposal');
|
|
227
228
|
});
|
|
228
229
|
});
|
|
229
|
-
describe('Methods for callable functions', () => {
|
|
230
|
-
test('Have correct parameters', () => {
|
|
230
|
+
(0, vitest_1.describe)('Methods for callable functions', () => {
|
|
231
|
+
(0, vitest_1.test)('Have correct parameters', () => {
|
|
231
232
|
const contract = generatedTypes.find(type => type.name === 'Contract');
|
|
232
|
-
expect(contract.methods.map((method) => [method.name, method.params])).toEqual([
|
|
233
|
+
(0, vitest_1.expect)(contract.methods.map((method) => [method.name, method.params])).toEqual([
|
|
233
234
|
['bind', immutable_1.default.List([ts.param('address', 'Address')])],
|
|
234
235
|
['read', immutable_1.default.List()],
|
|
235
236
|
['try_read', immutable_1.default.List()],
|
|
@@ -257,9 +258,9 @@ describe('ABI code generation', () => {
|
|
|
257
258
|
['try_overloaded2', immutable_1.default.List([ts.param('param0', 'Bytes')])],
|
|
258
259
|
]);
|
|
259
260
|
});
|
|
260
|
-
test('Have correct return types', () => {
|
|
261
|
+
(0, vitest_1.test)('Have correct return types', () => {
|
|
261
262
|
const contract = generatedTypes.find(type => type.name === 'Contract');
|
|
262
|
-
expect(contract.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
263
|
+
(0, vitest_1.expect)(contract.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
263
264
|
['bind', ts.namedType('Contract')],
|
|
264
265
|
['read', ts.namedType('Bytes')],
|
|
265
266
|
['try_read', 'ethereum.CallResult<Bytes>'],
|
|
@@ -276,34 +277,34 @@ describe('ABI code generation', () => {
|
|
|
276
277
|
]);
|
|
277
278
|
});
|
|
278
279
|
});
|
|
279
|
-
describe('Tuples', () => {
|
|
280
|
-
test('Tuple types exist for function parameters', () => {
|
|
280
|
+
(0, vitest_1.describe)('Tuples', () => {
|
|
281
|
+
(0, vitest_1.test)('Tuple types exist for function parameters', () => {
|
|
281
282
|
let tupleType = generatedTypes.find(type => type.name === 'Contract__getProposalInputParam1Struct');
|
|
282
283
|
// Verify that the tuple type has methods
|
|
283
|
-
expect(tupleType.methods).toBeDefined();
|
|
284
|
+
(0, vitest_1.expect)(tupleType.methods).toBeDefined();
|
|
284
285
|
// Verify that the tuple type has getters for all tuple fields with
|
|
285
286
|
// the right return types
|
|
286
|
-
expect(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
287
|
+
(0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
287
288
|
['get foo', 'i32'],
|
|
288
289
|
['get bar', 'Contract__getProposalInputParam1BarStruct'],
|
|
289
290
|
]);
|
|
290
291
|
// Inner tuple:
|
|
291
292
|
tupleType = generatedTypes.find(type => type.name === 'Contract__getProposalInputParam1BarStruct');
|
|
292
293
|
// Verify that the tuple type has methods
|
|
293
|
-
expect(tupleType.methods).toBeDefined();
|
|
294
|
+
(0, vitest_1.expect)(tupleType.methods).toBeDefined();
|
|
294
295
|
// Verify that the tuple type has getters for all tuple fields with
|
|
295
296
|
// the right return types
|
|
296
|
-
expect(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
297
|
+
(0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
297
298
|
['get baz', 'Address'],
|
|
298
299
|
]);
|
|
299
300
|
});
|
|
300
|
-
test('Tuple types exist for function return values', () => {
|
|
301
|
+
(0, vitest_1.test)('Tuple types exist for function return values', () => {
|
|
301
302
|
const tupleType = generatedTypes.find(type => type.name === 'Contract__getProposalResultValue0Struct');
|
|
302
303
|
// Verify that the tuple type has methods
|
|
303
|
-
expect(tupleType.methods).toBeDefined();
|
|
304
|
+
(0, vitest_1.expect)(tupleType.methods).toBeDefined();
|
|
304
305
|
// Verify that the tuple type has getters for all tuple fields with
|
|
305
306
|
// the right return types
|
|
306
|
-
expect(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
307
|
+
(0, vitest_1.expect)(tupleType.methods.map((method) => [method.name, method.returnType])).toEqual([
|
|
307
308
|
['get result', 'i32'],
|
|
308
309
|
['get target', 'Address'],
|
|
309
310
|
['get data', 'Bytes'],
|
|
@@ -315,11 +316,11 @@ describe('ABI code generation', () => {
|
|
|
315
316
|
['get noCount', 'BigInt'],
|
|
316
317
|
]);
|
|
317
318
|
});
|
|
318
|
-
test('Function bodies are generated correctly for tuple arrays', () => {
|
|
319
|
+
(0, vitest_1.test)('Function bodies are generated correctly for tuple arrays', () => {
|
|
319
320
|
const contract = generatedTypes.find(type => type.name === 'Contract');
|
|
320
321
|
const getter = contract.methods.find((method) => method.name === 'getProposals');
|
|
321
|
-
expect(getter.body).not.toContain('toTupleArray<undefined>');
|
|
322
|
-
expect(getter.body).toContain('result[1].toTupleArray<Contract__getProposalsResultValue1Struct>()');
|
|
322
|
+
(0, vitest_1.expect)(getter.body).not.toContain('toTupleArray<undefined>');
|
|
323
|
+
(0, vitest_1.expect)(getter.body).toContain('result[1].toTupleArray<Contract__getProposalsResultValue1Struct>()');
|
|
323
324
|
});
|
|
324
325
|
});
|
|
325
326
|
});
|