test: add cache on error test

This commit is contained in:
rickstaa 2022-10-10 12:48:26 +02:00
parent 4df8094e52
commit f0f92c2635
No known key found for this signature in database
GPG key ID: 0BD7401D30D23E53

View file

@ -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);