test: ignore `SharedComponent` in server head

This commit is contained in:
Daniel Roe 2024-08-22 16:22:37 +01:00
parent a0124712f3
commit 510f3e28ff
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
1 changed files with 4 additions and 4 deletions

View File

@ -2148,7 +2148,7 @@ describe('component islands', () => {
result.html = result.html.replace(/ data-island-uid="[^"]*"/g, '')
if (isDev()) {
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || (!l.href.includes('_nuxt/components/islands/RouteComponent') && !l.href.includes('PureComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */))
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || (!l.href.includes('_nuxt/components/islands/RouteComponent') && !l.href.includes('PureComponent') && !l.href.includes('SharedComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */))
}
expect(result).toMatchInlineSnapshot(`
@ -2170,7 +2170,7 @@ describe('component islands', () => {
}),
}))
if (isDev()) {
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || (!l.href.includes('_nuxt/components/islands/LongAsyncComponent') && !l.href.includes('PureComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */))
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || (!l.href.includes('_nuxt/components/islands/LongAsyncComponent') && !l.href.includes('PureComponent') && !l.href.includes('SharedComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */))
}
result.html = result.html.replaceAll(/ (data-island-uid|data-island-component)="([^"]*)"/g, '')
expect(result).toMatchInlineSnapshot(`
@ -2228,7 +2228,7 @@ describe('component islands', () => {
}),
}))
if (isDev()) {
result.head.link = result.head.link?.filter(l => typeof l.href === 'string' && !l.href.includes('PureComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */ && (!l.href.startsWith('_nuxt/components/islands/') || l.href.includes('AsyncServerComponent')))
result.head.link = result.head.link?.filter(l => typeof l.href === 'string' && !l.href.includes('PureComponent') && !l.href.includes('SharedComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */ && (!l.href.startsWith('_nuxt/components/islands/') || l.href.includes('AsyncServerComponent')))
}
result.props = {}
result.components = {}
@ -2253,7 +2253,7 @@ describe('component islands', () => {
it('render server component with selective client hydration', async () => {
const result = await $fetch<NuxtIslandResponse>('/__nuxt_island/ServerWithClient')
if (isDev()) {
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || (!l.href.includes('_nuxt/components/islands/LongAsyncComponent') && !l.href.includes('PureComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */))
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || (!l.href.includes('_nuxt/components/islands/LongAsyncComponent') && !l.href.includes('PureComponent') && !l.href.includes('SharedComponent') /* TODO: fix dev bug triggered by previous fetch of /islands */))
if (!result.head.link) {
delete result.head.link