diff --git a/__tests__/base/emit.test.ts b/__tests__/base/emit.test.ts index aa805e6a..34bc8019 100644 --- a/__tests__/base/emit.test.ts +++ b/__tests__/base/emit.test.ts @@ -91,6 +91,14 @@ describe('relative base emit', () => { expect(html).toMatch(/href="\.\/assets\/style\.[\w-]+\.css"/) }) + test('locale 404 renders at its own depth', () => { + const html = read('relative', 'zh/404.html') + expect(html).toContain( + 'window.__VP_SITE_ROOT__=new URL("../",location).href' + ) + expect(html).toMatch(/href="\.\.\/assets\/style\.[\w-]+\.css"/) + }) + test('no sentinel leaks into emitted html or css', () => { for (const file of walk(dist('relative'))) { if (!/\.(html|css)$/.test(file)) continue @@ -208,3 +216,44 @@ describe('plain base emit is unchanged', () => { expect(html).not.toContain('crossorigin>') }) }) + +describe('not-found emit', () => { + for (const mode of ['plain', 'relative', 'cdn', 'mpa']) { + test(`${mode}: the theme page stands in for a missing root 404.md`, () => { + const html = read(mode, '404.html') + expect(html).toContain('