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
@@ -10,7 +10,8 @@ vi.mock("node:worker_threads", () => {
|
||||
class FakeWorker {
|
||||
private handlers: Record<string, Handler[]> = {};
|
||||
on(event: string, handler: Handler) {
|
||||
(this.handlers[event] ??= []).push(handler);
|
||||
if (!this.handlers[event]) this.handlers[event] = [];
|
||||
this.handlers[event].push(handler);
|
||||
return this;
|
||||
}
|
||||
emit(event: string, ...args: unknown[]) {
|
||||
|
||||
@@ -24,6 +24,7 @@ vi.mock("@/lib/db", async () => {
|
||||
query.where = self;
|
||||
query.orderBy = self;
|
||||
query.limit = self;
|
||||
// biome-ignore lint/suspicious/noThenProperty: intentional thenable for await support
|
||||
query.then = (
|
||||
resolve: (value: unknown) => unknown,
|
||||
reject: (error: unknown) => unknown,
|
||||
@@ -45,11 +46,11 @@ import {
|
||||
} from "@/lib/theme-blocks";
|
||||
import { THEME_COLOR_KEYS } from "@/lib/theme-presets";
|
||||
import {
|
||||
type ResolvedTheme,
|
||||
generateScopedCss,
|
||||
getAllScopes,
|
||||
getFullScopeValues,
|
||||
getScopeValues,
|
||||
type ResolvedTheme,
|
||||
resolveTheme,
|
||||
} from "./theme-resolver";
|
||||
|
||||
@@ -155,9 +156,7 @@ describe("resolveTheme", () => {
|
||||
});
|
||||
|
||||
it("matches module scopes", async () => {
|
||||
state.scopes = [
|
||||
scope({ id: 1, type: "module", moduleId: "catalog" }),
|
||||
];
|
||||
state.scopes = [scope({ id: 1, type: "module", moduleId: "catalog" })];
|
||||
state.values = [value(1, "color_primary", "#module")];
|
||||
const resolved = await resolveTheme({ moduleId: "catalog" });
|
||||
expect(resolved.palette.color_primary).toBe("#module");
|
||||
@@ -212,7 +211,9 @@ describe("generateScopedCss", () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(rootCss).toContain('--theme-logo-url:url("http://logo/\\"quoted\\"")');
|
||||
expect(rootCss).toContain(
|
||||
'--theme-logo-url:url("http://logo/\\"quoted\\"")',
|
||||
);
|
||||
expect(scopedCssBlocks).toHaveLength(3);
|
||||
expect(scopedCssBlocks[0]).toMatch(/^\[data-theme-site="hotel\.test"\]\{/);
|
||||
expect(scopedCssBlocks[0]).toContain("--color-primary:#111111;");
|
||||
@@ -224,9 +225,7 @@ describe("generateScopedCss", () => {
|
||||
|
||||
describe("admin helpers", () => {
|
||||
it("getAllScopes normalises bigint ids", async () => {
|
||||
state.scopes = [
|
||||
scope({ id: 7n, parentId: 3n, type: "site" }),
|
||||
];
|
||||
state.scopes = [scope({ id: 7n, parentId: 3n, type: "site" })];
|
||||
const rows = await getAllScopes();
|
||||
expect(rows[0]?.id).toBe(7);
|
||||
expect(rows[0]?.parentId).toBe(3);
|
||||
|
||||
Reference in new issue
Block a user