From 6366a6cd036600c5eea83398bb11fc58fc42bd63 Mon Sep 17 00:00:00 2001 From: janniks Date: Thu, 1 Aug 2024 21:50:42 +0200 Subject: [PATCH] chore: update test --- src/env.ts | 4 ++-- src/helpers.ts | 4 ++-- src/tests/regtest.test.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/env.ts b/src/env.ts index deca89d..078e28a 100644 --- a/src/env.ts +++ b/src/env.ts @@ -47,11 +47,11 @@ const schema = Type.Object({ */ SKIP_UNLOCK: Type.Boolean({ default: false }), - POLL_INTERVAL: Type.Integer({ default: 750 }), + POLL_INTERVAL: Type.Integer({ default: 200 }), RETRY_INTERVAL: Type.Integer({ default: 500 }), STACKS_TX_TIMEOUT: Type.Integer({ default: 10_000 }), - BITCOIN_TX_TIMEOUT: Type.Integer({ default: 15_000 }), + BITCOIN_TX_TIMEOUT: Type.Integer({ default: 20_000 }), }); type Env = Static; diff --git a/src/helpers.ts b/src/helpers.ts index 6ad24d6..4df92a8 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -289,13 +289,13 @@ export async function waitForBurnBlockHeight( if (currentHeight === lastHeight) { if (Date.now() - lastHeightTime > ENV.BITCOIN_TX_TIMEOUT) { throw new Error( - `Burn block height hasn't changed for ${ENV.BITCOIN_TX_TIMEOUT} milliseconds` + `Burn block height hasn't changed for ${ENV.BITCOIN_TX_TIMEOUT / 1000} seconds` ); } } else { lastHeight = currentHeight; lastHeightTime = Date.now(); - console.log(`waiting for burn block ${burnBlockHeight} (current ${currentHeight})`); + console.log(`block height ${currentHeight} (waiting for ${burnBlockHeight})`); } await timeout(interval); diff --git a/src/tests/regtest.test.ts b/src/tests/regtest.test.ts index 86b96c8..e8bbfcf 100644 --- a/src/tests/regtest.test.ts +++ b/src/tests/regtest.test.ts @@ -83,7 +83,7 @@ describe('regtest-env pox-4', () => { maxAmount: amount, authId, }); - const res = await client.stack({ + const { txid } = await client.stack({ amountMicroStx: amount, poxAddress: steph.btcAddress, cycles: lockPeriod, @@ -94,10 +94,9 @@ describe('regtest-env pox-4', () => { authId, privateKey: steph.key, }); - console.log('res', res); - console.log('txid', res.txid); + console.log('txid', txid); - const result = await waitForTransaction(res.txid); + const result = await waitForTransaction(txid); expect(result.tx_result.repr).toContain('(ok'); expect(result.tx_status).toBe('success'); @@ -140,6 +139,7 @@ describe('regtest-env pox-4', () => { if (ENV.SKIP_UNLOCK) return; await waitForBurnBlockHeight(info.details.unlock_height + 2); + await timeout(200); info = await client.getStatus(); expect(info.stacked).toBeFalsy();