Skip to content

Commit 59ea6b4

Browse files
committedAug 6, 2019
address comments #2
1 parent 45c65a1 commit 59ea6b4

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed
 

‎packages/firestore/src/util/async_queue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export class AsyncQueue {
226226
op: () => Promise<T>
227227
): void {
228228
this.verifyNotFailed();
229+
// tslint:disable-next-line:no-floating-promises
229230
this.enqueueInternal(op);
230231
}
231232

‎packages/firestore/test/integration/api/database.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
apiDescribe,
3232
arrayContainsAnyOp,
3333
inOp,
34+
shutdownDb,
3435
withTestCollection,
3536
withTestDb,
3637
withTestDbs,
@@ -1073,7 +1074,7 @@ apiDescribe('Database', (persistence: boolean) => {
10731074
it('can start a new instance after shut down', async () => {
10741075
return withTestDoc(persistence, async docRef => {
10751076
const firestore = docRef.firestore;
1076-
await (firestore as any)._shutdown();
1077+
await shutdownDb(firestore);
10771078

10781079
const newFirestore = firebase.firestore!(firestore.app);
10791080
expect(newFirestore).to.not.equal(firestore);
@@ -1092,14 +1093,15 @@ apiDescribe('Database', (persistence: boolean) => {
10921093
const app = docRef.firestore.app;
10931094
await app.delete();
10941095

1096+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
10951097
expect((docRef.firestore as any)._isShutdown).to.be.true;
10961098
});
10971099
});
10981100

10991101
it('new operation after shutdown should throw', async () => {
11001102
await withTestDoc(persistence, async docRef => {
11011103
const firestore = docRef.firestore;
1102-
await (firestore as any)._shutdown();
1104+
await shutdownDb(firestore);
11031105

11041106
expect(() => {
11051107
firestore.doc(docRef.path).set({ foo: 'bar' });
@@ -1110,8 +1112,8 @@ apiDescribe('Database', (persistence: boolean) => {
11101112
it('calling shutdown mutiple times should proceed', async () => {
11111113
await withTestDoc(persistence, async docRef => {
11121114
const firestore = docRef.firestore;
1113-
await (firestore as any)._shutdown();
1114-
await (firestore as any)._shutdown();
1115+
await shutdownDb(firestore);
1116+
await shutdownDb(firestore);
11151117

11161118
expect(() => {
11171119
firestore.doc(docRef.path).set({ foo: 'bar' });

‎packages/firestore/test/integration/util/helpers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ function wipeDb(db: firestore.FirebaseFirestore): Promise<void> {
303303
return Promise.resolve(undefined);
304304
}
305305

306+
export function shutdownDb(db: firestore.FirebaseFirestore): Promise<void> {
307+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
308+
return (db as any)._shutdown();
309+
}
310+
306311
// TODO(in-queries): This exists just so we don't have to do the cast
307312
// repeatedly. Once we expose 'array-contains-any' publicly we can remove it and
308313
// just use 'array-contains-any' in all the tests.

0 commit comments

Comments
 (0)
Please sign in to comment.