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
+15
-18
@@ -30,7 +30,8 @@ vi.mock("@/lib/db", async () => {
|
||||
const schema = await import("@/db/schema");
|
||||
const { createFakeDb } = await import("@/test/fake-db");
|
||||
const fake = createFakeDb(() => {
|
||||
if (state.selectQueue.length) return state.selectQueue.shift() as Queue[number];
|
||||
if (state.selectQueue.length)
|
||||
return state.selectQueue.shift() as Queue[number];
|
||||
return state.rows;
|
||||
});
|
||||
const db = {
|
||||
@@ -121,9 +122,9 @@ describe("sendFriendRequest", () => {
|
||||
});
|
||||
|
||||
it("redirects to the root path when no username is supplied", async () => {
|
||||
await expect(sendFriendRequest(friendForm({ username: "" }))).rejects.toThrow(
|
||||
"/?friend=sent",
|
||||
);
|
||||
await expect(
|
||||
sendFriendRequest(friendForm({ username: "" })),
|
||||
).rejects.toThrow("/?friend=sent");
|
||||
expect(state.revalidatePath).toHaveBeenCalledWith("/messages");
|
||||
});
|
||||
|
||||
@@ -131,9 +132,9 @@ describe("sendFriendRequest", () => {
|
||||
await expect(
|
||||
sendFriendRequest(friendForm({ userId: "abc" })),
|
||||
).rejects.toThrow("/u/Bob?error=invalid");
|
||||
await expect(sendFriendRequest(friendForm({ userId: "0" }))).rejects.toThrow(
|
||||
"/u/Bob?error=invalid",
|
||||
);
|
||||
await expect(
|
||||
sendFriendRequest(friendForm({ userId: "0" })),
|
||||
).rejects.toThrow("/u/Bob?error=invalid");
|
||||
await expect(
|
||||
sendFriendRequest(friendForm({ userId: "5.5" })),
|
||||
).rejects.toThrow("/u/Bob?error=invalid");
|
||||
@@ -144,9 +145,9 @@ describe("sendFriendRequest", () => {
|
||||
});
|
||||
|
||||
it("blocks sending a request to yourself", async () => {
|
||||
await expect(sendFriendRequest(friendForm({ userId: "5" }))).rejects.toThrow(
|
||||
"/u/Bob?error=self",
|
||||
);
|
||||
await expect(
|
||||
sendFriendRequest(friendForm({ userId: "5" })),
|
||||
).rejects.toThrow("/u/Bob?error=self");
|
||||
expect(state.insert).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -209,8 +210,7 @@ describe("postThread", () => {
|
||||
state.selectQueue = [];
|
||||
state.rows = [];
|
||||
state.transaction.mockImplementation(
|
||||
async (fn: (tx: unknown) => Promise<unknown>, txDb: unknown) =>
|
||||
fn(txDb),
|
||||
async (fn: (tx: unknown) => Promise<unknown>, txDb: unknown) => fn(txDb),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -324,8 +324,7 @@ describe("replyToThread", () => {
|
||||
state.selectQueue = [];
|
||||
state.rows = [];
|
||||
state.transaction.mockImplementation(
|
||||
async (fn: (tx: unknown) => Promise<unknown>, txDb: unknown) =>
|
||||
fn(txDb),
|
||||
async (fn: (tx: unknown) => Promise<unknown>, txDb: unknown) => fn(txDb),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -350,9 +349,7 @@ describe("replyToThread", () => {
|
||||
updatedAt: expect.any(Number),
|
||||
});
|
||||
expect(state.revalidatePath).toHaveBeenCalledWith("/guilds/10/forum");
|
||||
expect(state.revalidatePath).toHaveBeenCalledWith(
|
||||
"/guilds/10/forum/20",
|
||||
);
|
||||
expect(state.revalidatePath).toHaveBeenCalledWith("/guilds/10/forum/20");
|
||||
});
|
||||
|
||||
it("floors a null posts_count at one", async () => {
|
||||
@@ -418,4 +415,4 @@ describe("replyToThread", () => {
|
||||
"/guilds/10/forum/20?error=error",
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user