Skip to content

Commit 88d6d01

Browse files
committed
update the last test
1 parent b84d374 commit 88d6d01

File tree

1 file changed

+5
-37
lines changed

1 file changed

+5
-37
lines changed

packages/firestore/test/lite/integration.test.ts

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,50 +2318,18 @@ describe('countQuery()', () => {
23182318
});
23192319
});
23202320

2321-
it.only('terminate Firestore while calling count query', () => {
2321+
it('terminate Firestore while calling count query', () => {
23222322
const testDocs = [
23232323
{ author: 'authorA', title: 'titleA' },
23242324
{ author: 'authorA', title: 'titleB' },
23252325
{ author: 'authorB', title: 'titleC' }
23262326
];
23272327
return withTestCollectionAndInitialData(testDocs, async collection => {
23282328
const countQuery_ = countQuery(query(collection));
2329-
2330-
//This will pass
2331-
// const promise = getAggregateFromServerDirect(countQuery_)
2332-
// await terminate(collection.firestore)
2333-
// expect((await promise).getCount()).to.equal(3);
2334-
2335-
//this will pass
2336-
// const [promise,voidResult] = await Promise.all([
2337-
// getAggregateFromServerDirect(countQuery_),
2338-
// terminate(collection.firestore),
2339-
// ])
2340-
// expect(promise.getCount()).to.equal(3);
2341-
2342-
//if terminate comes first, it will throw error
2343-
// expect(() => Promise.all([
2344-
// terminate(collection.firestore),
2345-
// getAggregateFromServerDirect(countQuery_),
2346-
// ])).to.throw(
2347-
// 'The client has already been terminated.'
2348-
// );
2349-
2350-
// not sure why, this is not getting to the "then" block
2351-
// and therefore it is not checking the "expect" at all
2352-
Promise.all([
2353-
getAggregateFromServerDirect(countQuery_),
2354-
terminate(collection.firestore)
2355-
])
2356-
.then(([promise, voidResult]) => {
2357-
console.log('snapshot', promise);
2358-
expect(promise.getCount()).to.equal(100);
2359-
})
2360-
.catch(e => {
2361-
expect((e as Error)?.message).to.equal(
2362-
'The client has already been terminated.'
2363-
);
2364-
});
2329+
const promise = getAggregateFromServerDirect(countQuery_);
2330+
await terminate(collection.firestore);
2331+
const snapshot = await promise;
2332+
expect(snapshot.getCount()).to.equal(3);
23652333
});
23662334
});
23672335
});

0 commit comments

Comments
 (0)