lint: fix biome issues in new test files and helpers
This commit is contained in:
1 parent
99eb3af17b
commit
93862c2275
41 files changed
+488
-314
No files matched your search
@@ -141,7 +141,7 @@ describe("saveTheme", () => {
|
||||
});
|
||||
|
||||
it("fails soft when a write fails and still redirects", async () => {
|
||||
fakeDbConfig.fail = (kind: string) => (kind === "insert" ? true : false);
|
||||
fakeDbConfig.fail = (kind: string) => kind === "insert";
|
||||
await saveTheme(form({ color_primary: "#123456" }));
|
||||
expect(mockReload).not.toHaveBeenCalled();
|
||||
expect(mockLogStaffActivity).not.toHaveBeenCalled();
|
||||
@@ -182,7 +182,7 @@ describe("applyPreset", () => {
|
||||
});
|
||||
|
||||
it("fails soft on write errors", async () => {
|
||||
fakeDbConfig.fail = (kind: string) => (kind === "insert" ? true : false);
|
||||
fakeDbConfig.fail = (kind: string) => kind === "insert";
|
||||
await applyPreset(form({ preset: "Ocean" }));
|
||||
expect(mockReload).not.toHaveBeenCalled();
|
||||
expect(mockLogStaffActivity).not.toHaveBeenCalled();
|
||||
@@ -195,10 +195,9 @@ describe("saveCustomTheme", () => {
|
||||
await saveCustomTheme(form({ name: "My Theme" }));
|
||||
|
||||
expect(mockSnapshotCurrentTheme).toHaveBeenCalledTimes(1);
|
||||
expect(mockUpsertCustomTheme).toHaveBeenCalledWith(
|
||||
"My Theme",
|
||||
{ color_primary: "#ffffff" },
|
||||
);
|
||||
expect(mockUpsertCustomTheme).toHaveBeenCalledWith("My Theme", {
|
||||
color_primary: "#ffffff",
|
||||
});
|
||||
expect(mockLogStaffActivity).toHaveBeenCalledWith({
|
||||
staffId: 3,
|
||||
action: "theme_preset",
|
||||
@@ -254,9 +253,7 @@ describe("applyCustomTheme", () => {
|
||||
}),
|
||||
);
|
||||
expect(mockRevalidatePath).toHaveBeenCalledWith("/", "layout");
|
||||
expect(mockRedirect).toHaveBeenCalledWith(
|
||||
"/admin/theme?theme=Studio",
|
||||
);
|
||||
expect(mockRedirect).toHaveBeenCalledWith("/admin/theme?theme=Studio");
|
||||
});
|
||||
|
||||
it("redirects when the id is blank", async () => {
|
||||
@@ -293,7 +290,7 @@ describe("applyCustomTheme", () => {
|
||||
createdAt: 0,
|
||||
settings: { color_primary: "#abcdef" },
|
||||
});
|
||||
fakeDbConfig.fail = (kind: string) => (kind === "insert" ? true : false);
|
||||
fakeDbConfig.fail = (kind: string) => kind === "insert";
|
||||
await applyCustomTheme(form({ id: "t1" }));
|
||||
expect(mockReload).not.toHaveBeenCalled();
|
||||
expect(mockLogStaffActivity).not.toHaveBeenCalled();
|
||||
@@ -358,4 +355,4 @@ describe("deleteCustomTheme", () => {
|
||||
expect(mockRevalidatePath).not.toHaveBeenCalled();
|
||||
expect(mockRedirect).toHaveBeenCalledWith("/admin/theme?deletedTheme=1");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user