test: fix assertion for style snapshot

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

View File

@ -1831,7 +1831,13 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
it('does not load stylesheet for page styles', async () => {
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 () => {