From cc79e21eb93f49e7eeb86548c89e84baaa021785 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 20 Apr 2020 08:08:47 -0700 Subject: [PATCH] fix(slp integration tests): Adding delay to fix the BVT --- test/integration/slp.js | 10 ++++++++++ test/integration/testnet/slp.js | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/test/integration/slp.js b/test/integration/slp.js index 1741d96..69aacad 100644 --- a/test/integration/slp.js +++ b/test/integration/slp.js @@ -22,6 +22,11 @@ describe(`#SLP`, () => { // console.log(`bchjs.SLP.apiToken: ${bchjs.SLP.apiToken}`) // }) + beforeEach(async () => { + // Introduce a delay so that the BVT doesn't trip the rate limits. + await sleep(1000) + }) + describe("#util", () => { describe("#list", () => { it(`should get information on the Spice token`, async () => { @@ -454,3 +459,8 @@ describe(`#SLP`, () => { }) }) }) + +// Promise-based sleep function +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) +} diff --git a/test/integration/testnet/slp.js b/test/integration/testnet/slp.js index 014e1e7..bfbe8b7 100644 --- a/test/integration/testnet/slp.js +++ b/test/integration/testnet/slp.js @@ -23,6 +23,11 @@ util.inspect.defaultOptions = { } describe(`#SLP`, () => { + beforeEach(async () => { + // Introduce a delay so that the BVT doesn't trip the rate limits. + await sleep(1000) + }) + describe("#util", () => { it(`should get information on the Oasis token`, async () => { const tokenId = `a371e9934c7695d08a5eb7f31d3bceb4f3644860cc67520cda1e149423b9ec39`