mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
An update that arrived while a route was still loading was lost, since the loader's result then counted as fresh, so the events now invalidate through the shared helper that marks such fetches stale. A repo arriving or renamed without the update naming its refs left the sidebar list as it was, and updates that changed nothing still dropped the hover caches. A test now checks the frontend's ref update type against the generated one.
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
|
|
import { isCobCacheKey, isJobsKey, isRepoInfoKey, keys } from "../src/keys";
|
|
|
|
const rid = "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5";
|
|
const id = "d87dcfe8c2b3200e78b128d9b959cfdf7063fefe";
|
|
|
|
describe("key classifiers", () => {
|
|
test("job lists", () => {
|
|
expect(isJobsKey(keys.jobs(rid))).toBe(true);
|
|
expect(isJobsKey(keys.repo(rid))).toBe(false);
|
|
expect(isJobsKey(keys.issues(rid))).toBe(false);
|
|
});
|
|
|
|
test("repository info", () => {
|
|
expect(isRepoInfoKey(keys.repoInfo(rid))).toBe(true);
|
|
expect(isRepoInfoKey(keys.repos())).toBe(false);
|
|
});
|
|
|
|
test("data the COB cache holds", () => {
|
|
for (const key of [
|
|
keys.repoInfo(rid),
|
|
keys.issues(rid),
|
|
keys.issueList(rid, "open"),
|
|
keys.issue(rid, id),
|
|
keys.patches(rid),
|
|
keys.patch(rid, id),
|
|
]) {
|
|
expect(isCobCacheKey(key)).toBe(true);
|
|
}
|
|
for (const key of [
|
|
keys.repo(rid),
|
|
keys.code(rid),
|
|
keys.jobs(rid),
|
|
keys.releases(rid),
|
|
keys.boards(rid),
|
|
keys.notifications(),
|
|
]) {
|
|
expect(isCobCacheKey(key)).toBe(false);
|
|
}
|
|
});
|
|
});
|