diff --git a/test/server-index-title.test.ts b/test/server-index-title.test.ts index 506e19bb..e2c7b979 100644 --- a/test/server-index-title.test.ts +++ b/test/server-index-title.test.ts @@ -96,16 +96,20 @@ describe('WebServer index.html templating (#82)', () => { it('only substitutes the <title> tag — the rest of the template is identical (modulo asset cache-busting)', async () => { // renderIndexHtml also appends ?v=<mtime> cache-bust params to same-origin - // .js/.css refs, and injects the CLI-availability flags before </head>; strip - // both so the title remains the only other change. + // .js/.css refs, and injects the CLI-availability flags plus the custom-model + // Run-menu picker's CLI list before </head>; strip all so the title remains + // the only other change. // - // The flag strip is what keeps this test environment-independent. It used to - // pass here by luck: the availability script was injected only where a CLI - // resolved, so the assertion held on a machine with none installed and would - // have failed on a developer's box that had them. + // The flag strips are what keep this test environment-independent. The + // CLI-availability one used to pass here by luck: that script was injected + // only where a CLI resolved, so the assertion held on a machine with none + // installed and would have failed on a developer's box that had them. The + // custom-model list is injected unconditionally (a plain array, possibly + // empty), so it needs stripping on every machine, not just where non-empty. const html = (await render('laptop')) .replace(/(\.(?:js|css))\?v=[^"]*/g, '$1') - .replace(/<script>window\.__codemanCliAvailable=\{.*?\};<\/script>\n/, ''); + .replace(/<script>window\.__codemanCliAvailable=\{.*?\};<\/script>\n/, '') + .replace(/<script>window\.__codemanCustomModelClis=\[.*?\];<\/script>\n/, ''); const beforeTitle = rawTemplate.split('<title>Codeman')[0]; const afterTitle = rawTemplate.split('Codeman')[1]; expect(html.startsWith(beforeTitle)).toBe(true);