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
@@ -86,7 +86,9 @@ import { DatabaseError } from "@/lib/foundation/errors";
|
||||
import { updateMotto, updateMottoAction } from "./user-settings";
|
||||
|
||||
const mockingForm = (motto: string): FormData =>
|
||||
({ get: (key: string) => (key === "motto" ? motto : null) }) as unknown as FormData;
|
||||
({
|
||||
get: (key: string) => (key === "motto" ? motto : null),
|
||||
}) as unknown as FormData;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -99,9 +101,7 @@ beforeEach(() => {
|
||||
|
||||
describe("updateMotto", () => {
|
||||
it("persists the motto, syncs RCON and revalidates /settings", async () => {
|
||||
await updateMotto(
|
||||
mockingForm(" hello world "),
|
||||
);
|
||||
await updateMotto(mockingForm(" hello world "));
|
||||
expect(state.updateCall.values).toEqual({ motto: " hello world " });
|
||||
expect(state.rconSetMotto).toHaveBeenCalledWith(42, " hello world ");
|
||||
expect(mockRevalidatePath).toHaveBeenCalledWith("/settings");
|
||||
@@ -126,9 +126,9 @@ describe("updateMotto", () => {
|
||||
await expect(updateMotto(mockingForm("boom"))).rejects.toThrow(
|
||||
databaseErrorClass,
|
||||
);
|
||||
await expect(
|
||||
updateMotto(mockingForm("boom")),
|
||||
).rejects.toThrow("Failed to update motto");
|
||||
await expect(updateMotto(mockingForm("boom"))).rejects.toThrow(
|
||||
"Failed to update motto",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not sync RCON when the DB update fails", async () => {
|
||||
@@ -177,4 +177,4 @@ describe("DatabaseError propagation", () => {
|
||||
expect(err).toBeInstanceOf(DatabaseError);
|
||||
expect(err.name).toBe("DatabaseError");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user