Add managed content and keyboard usage insights
Introduce versioned official content workflows and privacy-safe keyboard analytics, while preventing repeat DeviceCheck sign-ins from incorrectly restricting eligible accounts.
This commit is contained in:
@@ -57,6 +57,23 @@ describe("adminApi", () => {
|
||||
expect(request.credentials).toBe("include");
|
||||
});
|
||||
|
||||
it("内容发布请求携带 CSRF 并编码 Skill ID", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(
|
||||
new Response(null, { status: 204 }),
|
||||
);
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
setCsrfToken("csrf-content");
|
||||
|
||||
await adminApi.setContentSkillEnabled("official.skill/with space", true);
|
||||
|
||||
expect(fetchMock.mock.calls[0]?.[0]).toBe(
|
||||
"/v1/admin/content/skills/official.skill%2Fwith%20space/enable",
|
||||
);
|
||||
const request = fetchMock.mock.calls[0]?.[1] as RequestInit;
|
||||
expect((request.headers as Headers).get("X-CSRF-Token")).toBe("csrf-content");
|
||||
expect(request.method).toBe("POST");
|
||||
});
|
||||
|
||||
it("登录请求不依赖已有会话 CSRF", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(
|
||||
new Response(
|
||||
|
||||
Reference in New Issue
Block a user