diff --git a/src/database/fakeRemoveRemote.spec.ts b/src/database/fakeRemoveRemote.spec.ts index b6c7bb1c6ce..8a72e407c5a 100644 --- a/src/database/fakeRemoveRemote.spec.ts +++ b/src/database/fakeRemoveRemote.spec.ts @@ -29,19 +29,19 @@ export class FakeRemoveRemote implements RemoveRemote { return Promise.resolve(true); } - deleteSubPath(path: string, subPaths: string[]): Promise { + async deleteSubPath(path: string, subPaths: string[]): Promise { const d = this._dataAtpath(path); let size = 0; for (const p of subPaths) { size += this._size(d[p]); } if (size > this.largeThreshold) { - return Promise.resolve(false); + return false; } for (const p of subPaths) { - this.deletePath(`${path}/${p}`); + await this.deletePath(`${path}/${p}`); } - return Promise.resolve(true); + return true; } private _deletePath(path: string): void { diff --git a/src/deploy/extensions/planner.spec.ts b/src/deploy/extensions/planner.spec.ts index 029facd8168..4d0d10319b0 100644 --- a/src/deploy/extensions/planner.spec.ts +++ b/src/deploy/extensions/planner.spec.ts @@ -86,9 +86,9 @@ describe("Extensions Deployment Planner", () => { ]; for (const c of cases) { - it(c.description, () => { + it(c.description, async () => { if (!c.err) { - expect( + await expect( planner.resolveVersion( { publisherId: "test", @@ -99,7 +99,7 @@ describe("Extensions Deployment Planner", () => { ), ).to.eventually.equal(c.out); } else { - expect( + await expect( planner.resolveVersion( { publisherId: "test", diff --git a/src/deploy/functions/remoteSource.spec.ts b/src/deploy/functions/remoteSource.spec.ts index dd0157ae948..4bf1539906d 100644 --- a/src/deploy/functions/remoteSource.spec.ts +++ b/src/deploy/functions/remoteSource.spec.ts @@ -70,7 +70,7 @@ describe("remoteSource", () => { const entryPath = topLevelDir ? path.join(topLevelDir, filePath) : filePath; archive.append(content, { name: entryPath }); } - archive.finalize(); + archive.finalize().catch(reject); }); } diff --git a/src/deploy/functions/validate.spec.ts b/src/deploy/functions/validate.spec.ts index 7fcbbebd183..5e4a384a83d 100644 --- a/src/deploy/functions/validate.spec.ts +++ b/src/deploy/functions/validate.spec.ts @@ -767,19 +767,19 @@ describe("validate", () => { secretVersionStub.restore(); }); - it("passes validation with empty backend", () => { - expect(validate.secretsAreValid(project, backend.empty())).to.not.be.rejected; + it("passes validation with empty backend", async () => { + await expect(validate.secretsAreValid(project, backend.empty())).to.not.be.rejected; }); - it("passes validation with no secret env vars", () => { + it("passes validation with no secret env vars", async () => { const b = backend.of({ ...ENDPOINT, platform: "gcfv2", }); - expect(validate.secretsAreValid(project, b)).to.not.be.rejected; + await expect(validate.secretsAreValid(project, b)).to.not.be.rejected; }); - it("fails validation given non-existent secret version", () => { + it("fails validation given non-existent secret version", async () => { secretVersionStub.rejects({ reason: "Secret version does not exist" }); const b = backend.of({ @@ -793,13 +793,13 @@ describe("validate", () => { }, ], }); - expect(validate.secretsAreValid(project, b)).to.be.rejectedWith( + await expect(validate.secretsAreValid(project, b)).to.be.rejectedWith( FirebaseError, /Failed to validate secret version/, ); }); - it("fails validation given non-existent secret version", () => { + it("fails validation given non-existent secret version", async () => { secretVersionStub.rejects({ reason: "Secret version does not exist" }); const b = backend.of({ @@ -813,13 +813,13 @@ describe("validate", () => { }, ], }); - expect(validate.secretsAreValid(project, b)).to.be.rejectedWith( + await expect(validate.secretsAreValid(project, b)).to.be.rejectedWith( FirebaseError, /Failed to validate secret versions/, ); }); - it("fails validation given disabled secret version", () => { + it("fails validation given disabled secret version", async () => { secretVersionStub.resolves({ secret, versionId: "1", @@ -837,7 +837,7 @@ describe("validate", () => { }, ], }); - expect(validate.secretsAreValid(project, b)).to.be.rejectedWith( + await expect(validate.secretsAreValid(project, b)).to.be.rejectedWith( FirebaseError, /Failed to validate secret versions/, ); diff --git a/src/emulator/workQueue.spec.ts b/src/emulator/workQueue.spec.ts index 0e71af45075..2aa891f518e 100644 --- a/src/emulator/workQueue.spec.ts +++ b/src/emulator/workQueue.spec.ts @@ -20,7 +20,8 @@ describe("WorkQueue", () => { beforeEach(() => { queue = new WorkQueue(FunctionsExecutionMode.AUTO, MAX_PARALLEL); - queue.start(); + // Runs until afterEach calls stop(). + void queue.start(); }); afterEach(() => { @@ -90,7 +91,8 @@ describe("WorkQueue", () => { let queue: WorkQueue; beforeEach(() => { queue = new WorkQueue(FunctionsExecutionMode.SEQUENTIAL); - queue.start(); + // Runs until afterEach calls stop(). + void queue.start(); }); afterEach(() => { diff --git a/src/throttler/throttler.spec.ts b/src/throttler/throttler.spec.ts index d6185d1001c..e9a16a6b79f 100644 --- a/src/throttler/throttler.spec.ts +++ b/src/throttler/throttler.spec.ts @@ -235,7 +235,7 @@ const throttlerTest = (ThrottlerConstructor: ThrottlerConstructorType): void => }); }); - it("should return the result of task", () => { + it("should return the result of task", async () => { const handler = (task: number) => { return Promise.resolve(`result: ${task}`); }; @@ -244,8 +244,8 @@ const throttlerTest = (ThrottlerConstructor: ThrottlerConstructorType): void => handler, }); - expect(q.run(2)).to.eventually.to.equal("result: 2"); - expect(q.run(3)).to.eventually.to.equal("result: 3"); + await expect(q.run(2)).to.eventually.to.equal("result: 2"); + await expect(q.run(3)).to.eventually.to.equal("result: 3"); }); it("should resolve if task finishes before timeout", async () => {