style: apply biome lint fixes to catalog files and live repair tests
This commit is contained in:
1 parent
3e69b72513
commit
acbe54fcb7
5 files changed
+23
-21
No files matched your search
@@ -1,6 +1,10 @@
|
||||
import { z } from "zod";
|
||||
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
|
||||
.object({
|
||||
@@ -27,7 +31,9 @@ export const bulkOfferChangesSchema = z
|
||||
.refine(
|
||||
(v) =>
|
||||
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",
|
||||
);
|
||||
export const bulkOfferInputSchema = z
|
||||
|
||||
@@ -70,12 +70,8 @@ describe("emulator offer constraints", () => {
|
||||
expect(offerPatchSchema.parse({ amount: 1 })).toEqual({ amount: 1 });
|
||||
});
|
||||
it("rejects unsupported pointsType values", () => {
|
||||
expect(offerPatchSchema.safeParse({ pointsType: 101 }).success).toBe(
|
||||
false,
|
||||
);
|
||||
expect(offerPatchSchema.safeParse({ pointsType: 103 }).success).toBe(
|
||||
false,
|
||||
);
|
||||
expect(offerPatchSchema.safeParse({ pointsType: 101 }).success).toBe(false);
|
||||
expect(offerPatchSchema.safeParse({ pointsType: 103 }).success).toBe(false);
|
||||
expect(offerPatchSchema.safeParse({ pointsType: -1 }).success).toBe(false);
|
||||
});
|
||||
it("accepts supported pointsType values", () => {
|
||||
@@ -88,12 +84,10 @@ describe("emulator offer constraints", () => {
|
||||
});
|
||||
it("rejects limitedStack below limitedSells", () => {
|
||||
expect(
|
||||
offerPatchSchema.safeParse({ limitedStack: 0, limitedSells: 1 })
|
||||
.success,
|
||||
offerPatchSchema.safeParse({ limitedStack: 0, limitedSells: 1 }).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
offerPatchSchema.safeParse({ limitedStack: 5, limitedSells: 10 })
|
||||
.success,
|
||||
offerPatchSchema.safeParse({ limitedStack: 5, limitedSells: 10 }).success,
|
||||
).toBe(false);
|
||||
});
|
||||
it("accepts limitedStack >= limitedSells", () => {
|
||||
|
||||
@@ -52,7 +52,9 @@ export const offerPatchSchema = z
|
||||
.refine(
|
||||
(data) =>
|
||||
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",
|
||||
)
|
||||
.refine(
|
||||
|
||||
@@ -30,7 +30,7 @@ describe.skipIf(!runLive)("catalog asset repair (live)", () => {
|
||||
process.env[m[1]] = value;
|
||||
}
|
||||
}
|
||||
process.env["SKIP_ENV_VALIDATION"] = "1";
|
||||
process.env.SKIP_ENV_VALIDATION = "1";
|
||||
|
||||
[repairIcons, repairNitros] = await Promise.all([
|
||||
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 ?? ""}`);
|
||||
});
|
||||
log("icon result: " + JSON.stringify(iconResult));
|
||||
log(`icon result: ${JSON.stringify(iconResult)}`);
|
||||
|
||||
log("=== NITRO REPAIR START ===");
|
||||
lastPct = -1;
|
||||
@@ -73,10 +73,10 @@ describe.skipIf(!runLive)("catalog asset repair (live)", () => {
|
||||
}
|
||||
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("icons: " + JSON.stringify(iconResult));
|
||||
log("nitros: " + JSON.stringify(nitroResult));
|
||||
log(`icons: ${JSON.stringify(iconResult)}`);
|
||||
log(`nitros: ${JSON.stringify(nitroResult)}`);
|
||||
}, 1800000);
|
||||
});
|
||||
@@ -48,11 +48,11 @@ describe.skipIf(!runLive)("catalog repair direct (live)", () => {
|
||||
|
||||
log("=== ORPHANED REPAIR ===");
|
||||
const orphan = await repair.repairOrphanedCatalog();
|
||||
log("orphaned result: " + JSON.stringify(orphan));
|
||||
log(`orphaned result: ${JSON.stringify(orphan)}`);
|
||||
|
||||
log("=== DUPLICATE REPAIR ===");
|
||||
const dup = await repair.repairDuplicateClassnames();
|
||||
log("duplicate result: " + JSON.stringify(dup));
|
||||
log(`duplicate result: ${JSON.stringify(dup)}`);
|
||||
|
||||
log("=== VERIFY DUPLICATES ===");
|
||||
const [dupRows] = (await db.execute(sql`
|
||||
@@ -61,6 +61,6 @@ describe.skipIf(!runLive)("catalog repair direct (live)", () => {
|
||||
GROUP BY item_name
|
||||
HAVING cnt > 1
|
||||
`)) 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);
|
||||
});
|
||||
Reference in new issue
Block a user