diff --git a/packages/whale-api-client/__tests__/api/prices.test.ts b/packages/whale-api-client/__tests__/api/prices.test.ts index d5febe486..1c6cdba4e 100644 --- a/packages/whale-api-client/__tests__/api/prices.test.ts +++ b/packages/whale-api-client/__tests__/api/prices.test.ts @@ -605,7 +605,6 @@ describe('active price', () => { const height = await container.getBlockCount() await container.generate(1) await service.waitForIndexedHeight(height) - await new Promise((resolve) => setTimeout(resolve, 500)) const fixedIntervalPrice = await testing.rpc.oracle.getFixedIntervalPrice('S1/USD') const activePrice = await apiClient.prices.getFeedActive('S1', 'USD', 1) @@ -642,7 +641,6 @@ describe('active price', () => { const height = await container.getBlockCount() await container.generate(1) await service.waitForIndexedHeight(height) - await new Promise((resolve) => setTimeout(resolve, 500)) const fixedIntervalPrice = await testing.rpc.oracle.getFixedIntervalPrice('S1/USD') const activePrice = await apiClient.prices.getFeedActive('S1', 'USD', 1) @@ -684,7 +682,6 @@ describe('active price', () => { const height = await container.getBlockCount() await container.generate(1) await service.waitForIndexedHeight(height) - await new Promise((resolve) => setTimeout(resolve, 500)) const fixedIntervalPrice = await testing.rpc.oracle.getFixedIntervalPrice('S1/USD') const activePrice = await apiClient.prices.getFeedActive('S1', 'USD', 1) diff --git a/packages/whale-api-client/__tests__/stub.service.ts b/packages/whale-api-client/__tests__/stub.service.ts index e6ef89f90..4451b1f0a 100644 --- a/packages/whale-api-client/__tests__/stub.service.ts +++ b/packages/whale-api-client/__tests__/stub.service.ts @@ -45,7 +45,6 @@ export class StubService { const block = await blockMapper.getHighest() await expect(block?.height).toBeGreaterThan(height) }, timeout) - await new Promise((resolve) => setTimeout(resolve, 1000)) } async waitForIndexedTimestamp (container: MasterNodeRegTestContainer, timestamp: number, timeout: number = 30000): Promise { diff --git a/src/e2e.module.ts b/src/e2e.module.ts index ad8586dac..ec17a80bc 100644 --- a/src/e2e.module.ts +++ b/src/e2e.module.ts @@ -44,11 +44,6 @@ export async function stopTestingApp (container: MasterNodeRegTestContainer | Te await indexer.stop() await app.close() } finally { - await new Promise((resolve) => { - // Wait 2000ms between indexer cycle time to prevent database error - setTimeout(_ => resolve(0), 500) - }) - if (container instanceof MasterNodeRegTestContainer) { await container.stop() } else { @@ -76,7 +71,6 @@ export async function waitForIndexedHeight (app: NestFastifyApplication, height: const block = await blockMapper.getHighest() await expect(block?.height).toBeGreaterThan(height) }, timeout) - await new Promise((resolve) => setTimeout(resolve, 1000)) } /** diff --git a/src/module.api/loan.auction.history.e2e.ts b/src/module.api/loan.auction.history.e2e.ts index fc7894231..9a3306500 100644 --- a/src/module.api/loan.auction.history.e2e.ts +++ b/src/module.api/loan.auction.history.e2e.ts @@ -152,7 +152,8 @@ beforeAll(async () => { await tGroup.waitForSync() const height = await alice.container.call('getblockcount') - await waitForIndexedHeight(app, height - 1) + await alice.generate(1) + await waitForIndexedHeight(app, height) }) afterAll(async () => {