Add 22 test files covering imager, soundtracks, browser-headers, source-keys (figure/pet/effect), effect-source, plus catalog-translations, catalog-layouts, client-translation-files, translations-utils, and various admin/services/helpers modules. Total test count increases by 120+.
27 lines
828 B
TypeScript
27 lines
828 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { adminMutationNotice } from "./notice";
|
|
|
|
describe("adminMutationNotice", () => {
|
|
it("returns a danger notice when there is an error", () => {
|
|
expect(adminMutationNotice({ error: "boom" })).toEqual({
|
|
tone: "danger",
|
|
label: "Error",
|
|
message: "The operation could not be completed.",
|
|
});
|
|
});
|
|
it("returns a success notice when saved is 1", () => {
|
|
expect(adminMutationNotice({ saved: "1" })).toEqual({
|
|
tone: "ok",
|
|
label: "Saved",
|
|
message: "Changes were saved successfully.",
|
|
});
|
|
});
|
|
it("returns null when nothing is set", () => {
|
|
expect(adminMutationNotice({})).toBeNull();
|
|
});
|
|
it("prioritises errors over saved flags", () => {
|
|
const notice = adminMutationNotice({ saved: "1", error: "x" });
|
|
expect(notice?.tone).toBe("danger");
|
|
});
|
|
});
|