mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-04-28 21:05:36 +08:00
@@ -1052,6 +1052,7 @@ describe('BNS event server tests', () => {
|
||||
})
|
||||
|
||||
test('BNS middleware is async. /new_block posts return before importing BNS finishes', async () => {
|
||||
jest.useRealTimers();
|
||||
process.env.BNS_IMPORT_DIR = 'src/tests-bns/import-test-files';
|
||||
const genesisBlock = await getGenesisBlockData('src/tests-event-replay/tsv/mainnet.tsv');
|
||||
|
||||
@@ -1068,11 +1069,15 @@ describe('BNS event server tests', () => {
|
||||
expect(configState.bns_names_onchain_imported).toBe(false)
|
||||
expect(configState.bns_subdomains_imported).toBe(false)
|
||||
|
||||
await new Promise(resolve => setTimeout(async() => {
|
||||
const configState = await db.getConfigState();
|
||||
expect(configState.bns_names_onchain_imported).toBe(true)
|
||||
expect(configState.bns_subdomains_imported).toBe(true)
|
||||
resolve(undefined)
|
||||
}, 2000))
|
||||
const timeoutId: NodeJS.Timeout = await new Promise(resolve => {
|
||||
const timeoutId = setTimeout(async() => {
|
||||
const configState = await db.getConfigState();
|
||||
expect(configState.bns_names_onchain_imported).toBe(true)
|
||||
expect(configState.bns_subdomains_imported).toBe(true)
|
||||
resolve(timeoutId)
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user