fix(ci): stabilize post-cutover checks
This commit is contained in:
1 parent
6ae0aef6c0
commit
cdfae0b967
2 files changed
+27
-21
No files matched your search
@@ -77,19 +77,19 @@ describe("admin theme source audit", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("keeps retained Studio workflows on semantic status and overlay colors", () => {
|
it("keeps retained Studio workflows on semantic status and overlay colors", () => {
|
||||||
const violations = sourceFiles("src/components/admin/studio").flatMap(
|
const studioFiles = [
|
||||||
(file) => {
|
"src/features/housekeeping/domains/hotel/pages/studio.tsx",
|
||||||
const source = readFileSync(file, "utf8");
|
];
|
||||||
const risky =
|
const violations = studioFiles.flatMap((file) => {
|
||||||
source.match(/rgba?\([^)]*\)|(?:bg-black|text-white)(?:\/\d+)?/g) ??
|
const source = readFileSync(file, "utf8");
|
||||||
[];
|
const risky =
|
||||||
return risky.length
|
source.match(/rgba?\([^)]*\)|(?:bg-black|text-white)(?:\/\d+)?/g) ?? [];
|
||||||
? [
|
return risky.length
|
||||||
`${relative(process.cwd(), file).replaceAll("\\", "/")}: ${[...new Set(risky)].join(", ")}`,
|
? [
|
||||||
]
|
`${relative(process.cwd(), file).replaceAll("\\", "/")}: ${[...new Set(risky)].join(", ")}`,
|
||||||
: [];
|
]
|
||||||
},
|
: [];
|
||||||
);
|
});
|
||||||
expect(violations).toEqual([]);
|
expect(violations).toEqual([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
+14
-8
@@ -33,14 +33,20 @@ describe("cached (memory-only, no Redis)", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("recomputes after the TTL expires", async () => {
|
it("recomputes after the TTL expires", async () => {
|
||||||
let count = 0;
|
vi.useFakeTimers();
|
||||||
const fn = vi.fn(async () => ++count);
|
try {
|
||||||
const key = `ttl-${Math.random()}`;
|
vi.setSystemTime(1_000);
|
||||||
expect(await cached(key, 1, fn)).toBe(1);
|
let count = 0;
|
||||||
expect(await cached(key, 1, fn)).toBe(1);
|
const fn = vi.fn(async () => ++count);
|
||||||
await new Promise((r) => setTimeout(r, 10));
|
const key = `ttl-${Math.random()}`;
|
||||||
expect(await cached(key, 1, fn)).toBe(2);
|
expect(await cached(key, 100, fn)).toBe(1);
|
||||||
expect(fn).toHaveBeenCalledTimes(2);
|
expect(await cached(key, 100, fn)).toBe(1);
|
||||||
|
vi.advanceTimersByTime(100);
|
||||||
|
expect(await cached(key, 100, fn)).toBe(2);
|
||||||
|
expect(fn).toHaveBeenCalledTimes(2);
|
||||||
|
} finally {
|
||||||
|
vi.useRealTimers();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("invalidates a key so the next read recomputes", async () => {
|
it("invalidates a key so the next read recomputes", async () => {
|
||||||
|
|||||||
Reference in new issue
Block a user