diff --git a/tests/api.test.js b/tests/api.test.js index a6bb092..c05f25a 100644 --- a/tests/api.test.js +++ b/tests/api.test.js @@ -174,6 +174,16 @@ describe("Test /api/", () => { ]); }); + it("should not store cache when error", async () => { + const { req, res } = faker({}, error); + await api(req, res); + + expect(res.setHeader.mock.calls).toEqual([ + ["Content-Type", "image/svg+xml"], + ["Cache-Control", `no-store`], + ]); + }); + it("should set proper cache with clamped values", async () => { { let { req, res } = faker({ cache_seconds: 200000 }, data);