mirror of
https://github.com/certd/certd.git
synced 2026-05-17 13:57:31 +08:00
perf: 头像增加缓存时间
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/// <reference types="mocha" />
|
||||
/// <reference types="node" />
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { shouldSetDefaultNoCache } from "./configuration-cache.js";
|
||||
|
||||
describe("shouldSetDefaultNoCache", () => {
|
||||
it("sets default no-cache for html and api responses without cache headers", () => {
|
||||
assert.equal(shouldSetDefaultNoCache("/"), true);
|
||||
assert.equal(shouldSetDefaultNoCache("/index.html"), true);
|
||||
assert.equal(shouldSetDefaultNoCache("/api/basic/file/download"), true);
|
||||
});
|
||||
|
||||
it("keeps explicit cache headers from file responses", () => {
|
||||
assert.equal(shouldSetDefaultNoCache("/api/basic/file/download", "public,max-age=259200"), false);
|
||||
});
|
||||
|
||||
it("ignores non-html and non-api paths", () => {
|
||||
assert.equal(shouldSetDefaultNoCache("/static/images/logo.svg"), false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user