Clarify Hint pack save behavior
Keep manual editing while making save the only user action and applying changes immediately without a separate publish workflow.
This commit is contained in:
@@ -26,7 +26,7 @@ describe("内容管理", () => {
|
||||
expect(screen.queryByRole("button", { name: "新增 Skill" })).toBeNull();
|
||||
const editor = await screen.findByLabelText("zh JSON");
|
||||
expect(editor).toHaveProperty("readOnly", true);
|
||||
expect(screen.queryByRole("button", { name: "保存并立即发布" })).toBeNull();
|
||||
expect(screen.queryByRole("button", { name: "保存" })).toBeNull();
|
||||
expect(screen.queryByRole("button", { name: "立即生成" })).toBeNull();
|
||||
expect(screen.queryByRole("button", { name: "保存生成设置" })).toBeNull();
|
||||
});
|
||||
@@ -90,6 +90,25 @@ describe("内容管理", () => {
|
||||
|
||||
await waitFor(() => expect(regenerate).toHaveBeenCalledOnce());
|
||||
});
|
||||
|
||||
it("SUPER_ADMIN 可编辑并保存当前生效的 Hint pack", async () => {
|
||||
mockSession("SUPER_ADMIN");
|
||||
mockContent();
|
||||
const save = vi.spyOn(adminApi, "updateContentHintPack").mockResolvedValue({
|
||||
locale: "zh",
|
||||
generatedAt: "2026-08-21T06:00:00Z",
|
||||
intervalHours: 12,
|
||||
version: 3,
|
||||
cards: [],
|
||||
});
|
||||
window.location.hash = "#/content";
|
||||
render(<App />);
|
||||
|
||||
await userEvent.click(await screen.findByRole("button", { name: "保存" }));
|
||||
|
||||
await waitFor(() => expect(save).toHaveBeenCalledOnce());
|
||||
expect(await screen.findByText("version 3")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
function mockSession(role: AdminRole) {
|
||||
|
||||
Reference in New Issue
Block a user