Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Aug 1, 2024
1 parent 49d157c commit 6366a6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof schema>;

Expand Down
4 changes: 2 additions & 2 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/tests/regtest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 6366a6c

Please sign in to comment.