fix: resolve all Biome lint warnings
- Replace 'as any' with proper CurrencyDb type in send-currency test - Fix noTemplateCurlyInString warnings in deploy-workflow-contract test
This commit is contained in:
1 parent
14b9e77c1a
commit
af9f11d934
2 files changed
+34
-27
No files matched your search
@@ -1,15 +1,18 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { CurrencyDb } from "./send-currency";
|
||||
|
||||
vi.mock("@/lib/services/rcon", () => ({}));
|
||||
|
||||
import { sendCurrency } from "./send-currency";
|
||||
|
||||
const mockDb = {} as CurrencyDb;
|
||||
|
||||
describe("sendCurrency", () => {
|
||||
it("returns false for non-positive amount", async () => {
|
||||
expect(await sendCurrency({} as any, 1, "credits", 0)).toBe(false);
|
||||
expect(await sendCurrency({} as any, 1, "credits", -5)).toBe(false);
|
||||
expect(await sendCurrency({} as any, 1, "credits", null)).toBe(false);
|
||||
expect(await sendCurrency({} as any, 1, "credits", undefined)).toBe(false);
|
||||
expect(await sendCurrency({ rcon: {} as never, db: mockDb }, 1, "credits", 0)).toBe(false);
|
||||
expect(await sendCurrency({ rcon: {} as never, db: mockDb }, 1, "credits", -5)).toBe(false);
|
||||
expect(await sendCurrency({ rcon: {} as never, db: mockDb }, 1, "credits", null)).toBe(false);
|
||||
expect(await sendCurrency({ rcon: {} as never, db: mockDb }, 1, "credits", undefined)).toBe(false);
|
||||
});
|
||||
|
||||
it("delivers credits via RCON", async () => {
|
||||
@@ -20,7 +23,7 @@ describe("sendCurrency", () => {
|
||||
givePointsGotw: vi.fn(),
|
||||
};
|
||||
const result = await sendCurrency(
|
||||
{ rcon, db: {} as any },
|
||||
{ rcon, db: { user: { update: vi.fn() }, usersCurrency: { upsert: vi.fn() } } },
|
||||
1,
|
||||
"credits",
|
||||
100,
|
||||
@@ -40,7 +43,7 @@ describe("sendCurrency", () => {
|
||||
const result = await sendCurrency(
|
||||
{
|
||||
rcon,
|
||||
db: { user: { update: userUpdate } } as any,
|
||||
db: { user: { update: userUpdate }, usersCurrency: { upsert: vi.fn() } },
|
||||
},
|
||||
1,
|
||||
"credits",
|
||||
@@ -61,7 +64,7 @@ describe("sendCurrency", () => {
|
||||
givePointsGotw: vi.fn(),
|
||||
};
|
||||
const result = await sendCurrency(
|
||||
{ rcon, db: {} as any },
|
||||
{ rcon, db: { user: { update: vi.fn() }, usersCurrency: { upsert: vi.fn() } } },
|
||||
1,
|
||||
"duckets",
|
||||
50,
|
||||
@@ -81,7 +84,7 @@ describe("sendCurrency", () => {
|
||||
await sendCurrency(
|
||||
{
|
||||
rcon,
|
||||
db: { usersCurrency: { upsert } } as any,
|
||||
db: { user: { update: vi.fn() }, usersCurrency: { upsert } },
|
||||
},
|
||||
1,
|
||||
"duckets",
|
||||
@@ -107,7 +110,7 @@ describe("sendCurrency", () => {
|
||||
await sendCurrency(
|
||||
{
|
||||
rcon,
|
||||
db: { usersCurrency: { upsert } } as any,
|
||||
db: { user: { update: vi.fn() }, usersCurrency: { upsert } },
|
||||
},
|
||||
1,
|
||||
"diamonds",
|
||||
@@ -133,7 +136,7 @@ describe("sendCurrency", () => {
|
||||
await sendCurrency(
|
||||
{
|
||||
rcon,
|
||||
db: { usersCurrency: { upsert } } as any,
|
||||
db: { user: { update: vi.fn() }, usersCurrency: { upsert } },
|
||||
},
|
||||
1,
|
||||
"points",
|
||||
|
||||
Reference in new issue
Block a user