Skip to content

Commit 02ef09d

Browse files
committed
Add new test case.
1 parent 1ceead5 commit 02ef09d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

scripts/emulator-tests/functionsEmulator.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,4 +807,33 @@ describe("FunctionsEmulator-Hub", function () {
807807
});
808808
});
809809
});
810+
811+
it("should enforce timeout", async () => {
812+
await useFunction(
813+
emu,
814+
"timeoutFn",
815+
() => {
816+
return {
817+
timeoutFn: require("firebase-functions")
818+
.runWith({ timeoutSeconds: 1 })
819+
.https.onRequest((req: express.Request, res: express.Response): Promise<void> => {
820+
return new Promise((resolve) => {
821+
setTimeout(() => {
822+
res.sendStatus(200);
823+
resolve();
824+
}, 5_000);
825+
});
826+
}),
827+
};
828+
},
829+
["us-central1"],
830+
{
831+
timeoutSeconds: 1,
832+
}
833+
);
834+
835+
await supertest(emu.createHubServer())
836+
.get("/fake-project-id/us-central1/timeoutFn")
837+
.expect(500);
838+
});
810839
});

0 commit comments

Comments
 (0)