From 98fea1c09301ad6f141c8a0fd5443cf7913ff910 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Tue, 15 Oct 2019 16:26:11 -0700 Subject: [PATCH] Fix tests --- src/emulator/workQueue.ts | 2 +- src/test/emulators/functionsEmulator.spec.ts | 43 ++++++++++++++++---- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/emulator/workQueue.ts b/src/emulator/workQueue.ts index 79dcd1de4cb..b7c563511a0 100644 --- a/src/emulator/workQueue.ts +++ b/src/emulator/workQueue.ts @@ -27,7 +27,7 @@ export class WorkQueue { /** * Submit an entry to the queue and run it according to the WorkMode. - * + * * Note: make sure start() has been called at some point. */ submit(entry: Work) { diff --git a/src/test/emulators/functionsEmulator.spec.ts b/src/test/emulators/functionsEmulator.spec.ts index 9ae5f0634f6..c8c0afc0d55 100644 --- a/src/test/emulators/functionsEmulator.spec.ts +++ b/src/test/emulators/functionsEmulator.spec.ts @@ -8,6 +8,7 @@ import { FunctionsRuntimeBundle, } from "../../emulator/functionsEmulatorShared"; import * as express from "express"; +import { WorkQueue, WorkMode } from "../../emulator/workQueue"; if ((process.env.DEBUG || "").toLowerCase().indexOf("spec") >= 0) { // tslint:disable-next-line:no-var-requires @@ -49,7 +50,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .get("/fake-project-id/us-central1/function_id") .expect(200) @@ -71,7 +76,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .get("/fake-project-id/us-central1/function_id/") .expect(200) @@ -93,7 +102,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .get("/fake-project-id/us-central1/function_id/a/b") .expect(200) @@ -115,7 +128,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .get("/fake-project-id/us-central1/function_id/sub/route/a") .expect(200) @@ -137,7 +154,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .get("/fake-project-id/us-central1/function_id/sub/route/a") .expect(200) @@ -159,7 +180,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .post("/fake-project-id/us-central1/function_id/sub/route/a") .send({ hello: "world" }) @@ -182,7 +207,11 @@ describe("FunctionsEmulator-Hub", () => { }); await supertest( - FunctionsEmulator.createHubServer(FunctionRuntimeBundles.template, process.execPath) + FunctionsEmulator.createHubServer( + new WorkQueue(WorkMode.CONCURRENT), + FunctionRuntimeBundles.template, + process.execPath + ) ) .get("/fake-project-id/us-central1/function_id/sub/route/a?hello=world") .expect(200)