From 81d66eab4ec6cb1b47dcd8cbbe95b8ff10137863 Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Wed, 11 Oct 2023 13:05:52 -0300 Subject: [PATCH] refactor: deploy subgraph in initial test --- .prettierignore | 1 + .../isolated-pools/tests/integration/index.ts | 2 +- .../tests/integration/poolRegistry.ts | 3 --- .../isolated-pools/tests/integration/setup.ts | 18 ++++++++++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 subgraphs/isolated-pools/tests/integration/setup.ts diff --git a/.prettierignore b/.prettierignore index d219af63..f1745a1c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,3 +7,4 @@ hardhat.config.ts typechain-types /subgraphs/venus-governance/tests/integration/index.ts +/subgraphs/isolated-pools/tests/integration/index.ts diff --git a/subgraphs/isolated-pools/tests/integration/index.ts b/subgraphs/isolated-pools/tests/integration/index.ts index 4aa6ceb7..10f03698 100644 --- a/subgraphs/isolated-pools/tests/integration/index.ts +++ b/subgraphs/isolated-pools/tests/integration/index.ts @@ -1,4 +1,4 @@ -// The first test must deploy the subgraph +import './setup'; import './pool.ts'; import './poolRegistry.ts'; import './vTokens.ts'; diff --git a/subgraphs/isolated-pools/tests/integration/poolRegistry.ts b/subgraphs/isolated-pools/tests/integration/poolRegistry.ts index 1c85eac0..c753ab91 100644 --- a/subgraphs/isolated-pools/tests/integration/poolRegistry.ts +++ b/subgraphs/isolated-pools/tests/integration/poolRegistry.ts @@ -6,7 +6,6 @@ import { waitForSubgraphToBeSynced } from 'venus-subgraph-utils'; import subgraphClient from '../../subgraph-client'; import { defaultPools } from './constants'; -import deploy from './utils/deploy'; describe('Pool Registry', function () { let root: SignerWithAddress; @@ -22,8 +21,6 @@ describe('Pool Registry', function () { before(async function () { this.timeout(500000); // sometimes it takes a long time - await deploy(); - [root] = await ethers.getSigners(); poolRegistry = await ethers.getContract('PoolRegistry'); diff --git a/subgraphs/isolated-pools/tests/integration/setup.ts b/subgraphs/isolated-pools/tests/integration/setup.ts new file mode 100644 index 00000000..85e73d98 --- /dev/null +++ b/subgraphs/isolated-pools/tests/integration/setup.ts @@ -0,0 +1,18 @@ +import { deploy } from 'venus-subgraph-utils'; + +import { SUBGRAPH_ACCOUNT, SUBGRAPH_NAME, SYNC_DELAY } from './constants'; + +describe('Deploy Subgraph', function () { + it('should deploy subgraph', async function () { + this.timeout(500000); // sometimes it takes a long time + const root = `${__dirname}/../..`; + + await deploy({ + root, + packageName: 'isolated-pools-subgraph', + subgraphAccount: SUBGRAPH_ACCOUNT, + subgraphName: SUBGRAPH_NAME, + syncDelay: SYNC_DELAY, + }); + }); +});