Skip to content

Commit

Permalink
Fix unit test as liveQueries to measure from subscribe point.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfahlander committed Dec 11, 2023
1 parent fc572aa commit 4ea5e83
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/tests-live-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,22 @@ promisedTest("Full use case matrix", async ()=>{
}
}

const subscriptions = Object.keys(queries).map(name => observables.get(name).subscribe({
next: res => {},
error: error => ok(false, ''+error)
}));
const subscriptions = Object.keys(queries).map(name => {
let gotAnyData = false;
++flyingNow;
const subscription = observables.get(name).subscribe({
next: res => {
if (!gotAnyData) {
gotAnyData = true;
if (--flyingNow === 0) eventTarget.dispatchEvent(new CustomEvent('zeroflyers'));
}
},
error: error => {
ok(false, ''+error)
}
});
return subscription;
});
try {
await zeroFlyers(timeout(200));
deepEqual(actualResults, expectedInitialResults, "Initial results as expected");
Expand Down

0 comments on commit 4ea5e83

Please sign in to comment.