Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Oct 15, 2019
1 parent e1fb07e commit 98fea1c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/emulator/workQueue.ts
Expand Up @@ -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) {
Expand Down
43 changes: 36 additions & 7 deletions src/test/emulators/functionsEmulator.spec.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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" })
Expand All @@ -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)
Expand Down

0 comments on commit 98fea1c

Please sign in to comment.