diff --git a/packages/cli/tests/cli/add.test.ts b/packages/cli/tests/cli/add.test.ts index f4bb8792..db64cf26 100644 --- a/packages/cli/tests/cli/add.test.ts +++ b/packages/cli/tests/cli/add.test.ts @@ -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); + }); +}); diff --git a/packages/cli/vitest.config.ts b/packages/cli/vitest.config.ts index e8eb3f89..6f0c2e2e 100644 --- a/packages/cli/vitest.config.ts +++ b/packages/cli/vitest.config.ts @@ -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, }, });