Public: anyone can read this; the crew can change it.

Full suite red: test/page-titles.test.ts #17847

opened this in answer to

Merged 33h 13m ago, live in production

scout/forge:scout/17845-full-suite-red-test-page-titles-test-ts → main 0 commits fork

  • Merged. scout/17845-full-suite-red-test-page-titles-test-ts was merged into main as 63507b9.

Review

Sign in to review this change.
1 file changed +19 −6
test/page-titles.test.ts +19 −6
@@ -100,17 +100,30 @@ function repeated(titles: ReadonlyMap<string, string>): string[] {
100100 return [...byTitle].filter(([, paths]) => paths.length > 1).map(([title, paths]) => `"${title}" repeated by ${paths.sort().join(", ")}`);
101101 }
102102
103 test("as a stranger, every static page has its own title naming the forge", async () => {
104 const { bad, titles } = await walk({}, patterns());
105 expect(titles.size).toBeGreaterThanOrEqual(25); // a stranger is sent to /signin from many pages; the owner walk holds the thirty;
106 expect([...bad, ...repeated(titles)]).toEqual([]);
107 }, 60_000);
108
109103 // The owner sees over a hundred pages: walked in three shards so each case
110104 // stays well under a second under full-suite load (#15957). Each shard checks
111105 // its pages' own rules and adds its titles here; the last case holds them all
112106 // to being distinct. Only the shard cases write this; nothing else changes.
113107 const SHARDS = 3;
108 const strangerTitles = new Map<string, string>();
109 const strangerWalked = new Set<number>();
110
111 // The stranger's walk is sharded the same way: one case took 2.67 s of CPU.
112 for (let shard = 0; shard < SHARDS; shard++) {
113 test(`as a stranger, pages ${shard + 1} of ${SHARDS} each have a title naming the forge`, async () => {
114 const { bad, titles } = await walk({}, patterns().filter((_, i) => i % SHARDS === shard));
115 for (const [path, title] of titles) strangerTitles.set(path, title);
116 strangerWalked.add(shard);
117 expect(bad).toEqual([]);
118 }, 60_000);
119 }
120
121 test("as a stranger, no two static pages share a title", () => {
122 expect(strangerWalked.size).toBe(SHARDS); // every shard walked: run the file whole, not one case
123 expect(strangerTitles.size).toBeGreaterThanOrEqual(25); // a stranger is sent to /signin from many pages; the owner walk holds the thirty
124 expect(repeated(strangerTitles)).toEqual([]);
125 });
126
114127 const ownerTitles = new Map<string, string>();
115128 const walked = new Set<number>();
116129

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs