style: apply biome lint fixes to catalog files and live repair tests
CI / check (push) Successful in 55s
CI / deploy (push) Successful in 1m23s
CI / publish-container (push) Successful in 45s

This commit is contained in:
openhands committed 2026-09-10 11:32:20 +02:00
1 parent 3e69b72513
commit acbe54fcb7
5 files changed
+23 -21

No files matched your search

+8 -2
View File
@@ -1,6 +1,10 @@
import { z } from "zod"; import { z } from "zod";
import { CatalogInputError } from "./hierarchy"; import { CatalogInputError } from "./hierarchy";
import { EMULATOR_POINTS_TYPES, offerIdSchema, offerInteger } from "./offer-input"; import {
EMULATOR_POINTS_TYPES,
offerIdSchema,
offerInteger,
} from "./offer-input";
const priceChange = z const priceChange = z
.object({ .object({
@@ -27,7 +31,9 @@ export const bulkOfferChangesSchema = z
.refine( .refine(
(v) => (v) =>
v.pointsType === undefined || v.pointsType === undefined ||
EMULATOR_POINTS_TYPES.includes(v.pointsType as (typeof EMULATOR_POINTS_TYPES)[number]), EMULATOR_POINTS_TYPES.includes(
v.pointsType as (typeof EMULATOR_POINTS_TYPES)[number],
),
"Points type is not supported by the emulator", "Points type is not supported by the emulator",
); );
export const bulkOfferInputSchema = z export const bulkOfferInputSchema = z
@@ -70,12 +70,8 @@ describe("emulator offer constraints", () => {
expect(offerPatchSchema.parse({ amount: 1 })).toEqual({ amount: 1 }); expect(offerPatchSchema.parse({ amount: 1 })).toEqual({ amount: 1 });
}); });
it("rejects unsupported pointsType values", () => { it("rejects unsupported pointsType values", () => {
expect(offerPatchSchema.safeParse({ pointsType: 101 }).success).toBe( expect(offerPatchSchema.safeParse({ pointsType: 101 }).success).toBe(false);
false, expect(offerPatchSchema.safeParse({ pointsType: 103 }).success).toBe(false);
);
expect(offerPatchSchema.safeParse({ pointsType: 103 }).success).toBe(
false,
);
expect(offerPatchSchema.safeParse({ pointsType: -1 }).success).toBe(false); expect(offerPatchSchema.safeParse({ pointsType: -1 }).success).toBe(false);
}); });
it("accepts supported pointsType values", () => { it("accepts supported pointsType values", () => {
@@ -88,12 +84,10 @@ describe("emulator offer constraints", () => {
}); });
it("rejects limitedStack below limitedSells", () => { it("rejects limitedStack below limitedSells", () => {
expect( expect(
offerPatchSchema.safeParse({ limitedStack: 0, limitedSells: 1 }) offerPatchSchema.safeParse({ limitedStack: 0, limitedSells: 1 }).success,
.success,
).toBe(false); ).toBe(false);
expect( expect(
offerPatchSchema.safeParse({ limitedStack: 5, limitedSells: 10 }) offerPatchSchema.safeParse({ limitedStack: 5, limitedSells: 10 }).success,
.success,
).toBe(false); ).toBe(false);
}); });
it("accepts limitedStack >= limitedSells", () => { it("accepts limitedStack >= limitedSells", () => {
+3 -1
View File
@@ -52,7 +52,9 @@ export const offerPatchSchema = z
.refine( .refine(
(data) => (data) =>
data.pointsType === undefined || data.pointsType === undefined ||
EMULATOR_POINTS_TYPES.includes(data.pointsType as (typeof EMULATOR_POINTS_TYPES)[number]), EMULATOR_POINTS_TYPES.includes(
data.pointsType as (typeof EMULATOR_POINTS_TYPES)[number],
),
"Points type is not supported by the emulator", "Points type is not supported by the emulator",
) )
.refine( .refine(
@@ -30,7 +30,7 @@ describe.skipIf(!runLive)("catalog asset repair (live)", () => {
process.env[m[1]] = value; process.env[m[1]] = value;
} }
} }
process.env["SKIP_ENV_VALIDATION"] = "1"; process.env.SKIP_ENV_VALIDATION = "1";
[repairIcons, repairNitros] = await Promise.all([ [repairIcons, repairNitros] = await Promise.all([
import("@/lib/services/repair-icons").then((m) => m.repairMissingIcons), import("@/lib/services/repair-icons").then((m) => m.repairMissingIcons),
@@ -56,7 +56,7 @@ describe.skipIf(!runLive)("catalog asset repair (live)", () => {
} }
if (evt.type === "error") log(`ICON ERROR: ${evt.message ?? ""}`); if (evt.type === "error") log(`ICON ERROR: ${evt.message ?? ""}`);
}); });
log("icon result: " + JSON.stringify(iconResult)); log(`icon result: ${JSON.stringify(iconResult)}`);
log("=== NITRO REPAIR START ==="); log("=== NITRO REPAIR START ===");
lastPct = -1; lastPct = -1;
@@ -73,10 +73,10 @@ describe.skipIf(!runLive)("catalog asset repair (live)", () => {
} }
if (evt.type === "error") log(`NITRO ERROR: ${evt.message ?? ""}`); if (evt.type === "error") log(`NITRO ERROR: ${evt.message ?? ""}`);
}); });
log("nitro result: " + JSON.stringify(nitroResult)); log(`nitro result: ${JSON.stringify(nitroResult)}`);
log("=== ASSET REPAIR COMPLETE ==="); log("=== ASSET REPAIR COMPLETE ===");
log("icons: " + JSON.stringify(iconResult)); log(`icons: ${JSON.stringify(iconResult)}`);
log("nitros: " + JSON.stringify(nitroResult)); log(`nitros: ${JSON.stringify(nitroResult)}`);
}, 1800000); }, 1800000);
}); });
@@ -48,11 +48,11 @@ describe.skipIf(!runLive)("catalog repair direct (live)", () => {
log("=== ORPHANED REPAIR ==="); log("=== ORPHANED REPAIR ===");
const orphan = await repair.repairOrphanedCatalog(); const orphan = await repair.repairOrphanedCatalog();
log("orphaned result: " + JSON.stringify(orphan)); log(`orphaned result: ${JSON.stringify(orphan)}`);
log("=== DUPLICATE REPAIR ==="); log("=== DUPLICATE REPAIR ===");
const dup = await repair.repairDuplicateClassnames(); const dup = await repair.repairDuplicateClassnames();
log("duplicate result: " + JSON.stringify(dup)); log(`duplicate result: ${JSON.stringify(dup)}`);
log("=== VERIFY DUPLICATES ==="); log("=== VERIFY DUPLICATES ===");
const [dupRows] = (await db.execute(sql` const [dupRows] = (await db.execute(sql`
@@ -61,6 +61,6 @@ describe.skipIf(!runLive)("catalog repair direct (live)", () => {
GROUP BY item_name GROUP BY item_name
HAVING cnt > 1 HAVING cnt > 1
`)) as unknown as [Array<{ item_name: string; cnt: number }>, unknown]; `)) as unknown as [Array<{ item_name: string; cnt: number }>, unknown];
log("remaining duplicate groups: " + JSON.stringify(dupRows)); log(`remaining duplicate groups: ${JSON.stringify(dupRows)}`);
}, 300000); }, 300000);
}); });