Skip to content

Commit

Permalink
Increase hookTimeout for Node18 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h committed Dec 5, 2024
1 parent ef1a325 commit 8d9bbae
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 40 deletions.
76 changes: 36 additions & 40 deletions packages/cli/tests/cli/add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,39 @@ const EXAMPLE_SUBGRAPH_PATH = path.join(__dirname, 'add', 'subgraph');

const TEMP_SUBGRAPH_PATH = path.join(__dirname, 'add', 'tmp-subgraph');

describe(
'Add command',
() => {
beforeAll(async () => {
toolbox.filesystem.remove(TEMP_SUBGRAPH_PATH); // If the tests fail before AfterAll is called
toolbox.filesystem.copy(EXAMPLE_SUBGRAPH_PATH, TEMP_SUBGRAPH_PATH);

await runGraphCli(
[
'add',
'0x2E645469f354BB4F5c8a05B3b30A929361cf77eC',
'--contract-name',
'Gravatar',
'--abi',
`${EXAMPLE_SUBGRAPH_PATH}/abis/Gravity.json`,
],
TEMP_SUBGRAPH_PATH,
);
});

afterAll(async () => {
toolbox.filesystem.remove(TEMP_SUBGRAPH_PATH);
});

it('should add a new datasource to a subgraph', () => {
const manifest = fs.readFileSync(`${TEMP_SUBGRAPH_PATH}/subgraph.yaml`);
const expected = fs.readFileSync(`${__dirname}/add/expected/subgraph.yaml`);

expect(manifest.equals(expected)).toBe(true);
});

it('should not overwrite the ABI file', () => {
const abi = fs.readFileSync(`${TEMP_SUBGRAPH_PATH}/abis/Gravatar.json`);
const expected = fs.readFileSync(`${__dirname}/add/expected/Gravatar.json`);

expect(expected.equals(abi)).toBe(true);
});
},
{ timeout: 20_000 },
);
describe('Add command', () => {
beforeAll(async () => {
toolbox.filesystem.remove(TEMP_SUBGRAPH_PATH); // If the tests fail before AfterAll is called
toolbox.filesystem.copy(EXAMPLE_SUBGRAPH_PATH, TEMP_SUBGRAPH_PATH);

await runGraphCli(
[
'add',
'0x2E645469f354BB4F5c8a05B3b30A929361cf77eC',
'--contract-name',
'Gravatar',
'--abi',
`${EXAMPLE_SUBGRAPH_PATH}/abis/Gravity.json`,
],
TEMP_SUBGRAPH_PATH,
);
});

afterAll(async () => {
toolbox.filesystem.remove(TEMP_SUBGRAPH_PATH);
});

it('should add a new datasource to a subgraph', () => {
const manifest = fs.readFileSync(`${TEMP_SUBGRAPH_PATH}/subgraph.yaml`);
const expected = fs.readFileSync(`${__dirname}/add/expected/subgraph.yaml`);

expect(manifest.equals(expected)).toBe(true);
});

it('should not overwrite the ABI file', () => {
const abi = fs.readFileSync(`${TEMP_SUBGRAPH_PATH}/abis/Gravatar.json`);
const expected = fs.readFileSync(`${__dirname}/add/expected/Gravatar.json`);

expect(expected.equals(abi)).toBe(true);
});
});
1 change: 1 addition & 0 deletions packages/cli/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default defineConfig({
// node v21 has warnings about the deprecation of punycode which can break test snapshots
NODE_NO_WARNINGS: '1',
},
hookTimeout: 20_000,
},
});

0 comments on commit 8d9bbae

Please sign in to comment.