Skip to content

Commit

Permalink
Made close callbacks async
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Oct 9, 2023
1 parent 1a1e67a commit 48af4c2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/beacon-node/test/e2e/api/lodestar/lodestar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe("api / impl / validator", function () {
const timeout = (SLOTS_PER_EPOCH + genesisSlotsDelay) * testParams.SECONDS_PER_SLOT * 1000;

const afterEachCallbacks: (() => Promise<unknown> | void)[] = [];

afterEach(async () => {
while (afterEachCallbacks.length > 0) {
const callback = afterEachCallbacks.pop();
Expand All @@ -48,7 +49,9 @@ describe("api / impl / validator", function () {
validatorCount,
logger: loggerNodeA,
});
afterEachCallbacks.push(() => bn.close());
afterEachCallbacks.push(async () => {
await bn.close();
});

// live indices at epoch of consideration, epoch 0
bn.chain.seenBlockProposers.add(0, 1);
Expand Down Expand Up @@ -97,7 +100,9 @@ describe("api / impl / validator", function () {
validatorCount,
logger: loggerNodeA,
});
afterEachCallbacks.push(() => bn.close());
afterEachCallbacks.push(async () => {
await bn.close();
});

await waitForEvent<phase0.Checkpoint>(bn.chain.clock, ClockEvent.epoch, timeout); // wait for epoch 1
await waitForEvent<phase0.Checkpoint>(bn.chain.clock, ClockEvent.epoch, timeout); // wait for epoch 2
Expand Down

0 comments on commit 48af4c2

Please sign in to comment.