test: fix assertion for style snapshot

This commit is contained in:
Daniel Roe 2024-09-26 09:36:38 +01:00
parent 4a84ec89e6
commit 7f311e7730
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -1834,7 +1834,13 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
it('does not load stylesheet for page styles', async () => { it('does not load stylesheet for page styles', async () => {
const html: string = await $fetch<string>('/styles') const html: string = await $fetch<string>('/styles')
expect(html.match(/<link [^>]*href="[^"]*\.css">(?: crossorigin)?/g)?.filter(m => m.includes('entry'))?.map(m => m.replace(/\.[^.]*\.css/, '.css'))).toMatchInlineSnapshot(`undefined`) const cssFiles = html.match(/<link [^>]*href="[^"]*\.css"/g)
expect(cssFiles?.length).toBeGreaterThan(0)
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/\.[^.]*\.css/, '.css'))).toMatchInlineSnapshot(`
[
"<link rel="stylesheet" href="/_nuxt/entry.css"",
]
`)
}) })
it('still downloads client-only styles', async () => { it('still downloads client-only styles', async () => {