Skip to content

Commit

Permalink
changed test to resolve once the acks are processed to guarantee the …
Browse files Browse the repository at this point in the history
…status checks.
  • Loading branch information
aricart committed Sep 28, 2022
1 parent bdad440 commit a0043e2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/jetstream_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1490,13 +1490,19 @@ Deno.test("jetstream - cross account subscribe", async () => {
const js = nc.jetstream({ apiPrefix: "IPA" });

const opts = bo.getOpts();
const acks: Promise<boolean>[] = [];
const d = deferred();
const sub = await js.subscribe(subj, opts);
await (async () => {
for await (const m of sub) {
m.ack();
acks.push(m.ackAck());
if (m.seq === 2) {
d.resolve();
}
}
})();
await nc.flush();
await d;
await Promise.all(acks);
const ci = await sub.consumerInfo();
assertEquals(ci.num_pending, 0);
assertEquals(ci.delivered.stream_seq, 2);
Expand Down

0 comments on commit a0043e2

Please sign in to comment.