mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-24 09:28:41 +00:00
test: avoid snapshot with hashes
This commit is contained in:
parent
716b291421
commit
be862e8f84
@ -1707,27 +1707,38 @@ describe('component islands', () => {
|
|||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
result.head.link = result.head.link.filter(l => !l.href.includes('@nuxt+ui-templates') && (l.href.startsWith('_nuxt/components/islands/') && l.href.includes('_nuxt/components/islands/AsyncServerComponent')))
|
result.head.link = result.head.link.filter(l => !l.href.includes('@nuxt+ui-templates') && (l.href.startsWith('_nuxt/components/islands/') && l.href.includes('_nuxt/components/islands/AsyncServerComponent')))
|
||||||
}
|
}
|
||||||
|
const { props, teleports, chunks } = result
|
||||||
|
result.props = {}
|
||||||
|
result.teleports = {}
|
||||||
|
result.chunks = {}
|
||||||
expect(result).toMatchInlineSnapshot(`
|
expect(result).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"chunks": {
|
"chunks": {},
|
||||||
"SugarCounter": "_nuxt/SugarCounter.vue.d67a99b8.js",
|
|
||||||
},
|
|
||||||
"head": {
|
"head": {
|
||||||
"link": [],
|
"link": [],
|
||||||
"style": [],
|
"style": [],
|
||||||
},
|
},
|
||||||
"html": "<div nuxt-ssr-component-uid> This is a .server (20ms) async component that was very long ... <div id=\\"async-server-component-count\\">2</div><div class=\\"sugar-counter\\"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><div style=\\"border:solid 1px red;\\"> The component bellow is not a slot but declared as interactive <!--[--><div style=\\"display: contents;\\" nuxt-ssr-client=\\"SugarCounter-5rNaTHATD9\\"></div><!--teleport start--><!--teleport end--><!--]--></div><div style=\\"display:contents;\\" nuxt-ssr-slot-name=\\"default\\"></div></div>",
|
"html": "<div nuxt-ssr-component-uid> This is a .server (20ms) async component that was very long ... <div id=\\"async-server-component-count\\">2</div><div class=\\"sugar-counter\\"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><div style=\\"border:solid 1px red;\\"> The component bellow is not a slot but declared as interactive <!--[--><div style=\\"display: contents;\\" nuxt-ssr-client=\\"SugarCounter-5rNaTHATD9\\"></div><!--teleport start--><!--teleport end--><!--]--></div><div style=\\"display:contents;\\" nuxt-ssr-slot-name=\\"default\\"></div></div>",
|
||||||
"props": {
|
"props": {},
|
||||||
"SugarCounter-5rNaTHATD9": {
|
|
||||||
"multiplier": 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"state": {},
|
"state": {},
|
||||||
"teleports": {
|
"teleports": {},
|
||||||
"SugarCounter-5rNaTHATD9": "<div class=\\"sugar-counter\\"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><!--teleport anchor-->",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
const propsEntries = Object.entries(props)
|
||||||
|
const teleportsEntries = Object.entries(teleports)
|
||||||
|
const chunksEntries = Object.entries(chunks)
|
||||||
|
expect(propsEntries).toHaveLength(1)
|
||||||
|
expect(teleportsEntries).toHaveLength(1)
|
||||||
|
expect(propsEntries[0][0].startsWith('SugarCounter-')).toBeTruthy()
|
||||||
|
expect(propsEntries[0][0].startsWith('SugarCounter-')).toBeTruthy()
|
||||||
|
expect(chunksEntries[0][0]).toBe('SugarCounter')
|
||||||
|
expect(propsEntries[0][1]).toMatchInlineSnapshot(`
|
||||||
|
{
|
||||||
|
"multiplier": 1,
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
expect(teleportsEntries[0][1]).toMatchInlineSnapshot('"<div class=\\"sugar-counter\\"> Sugar Counter 12 x 1 = 12 <button> Inc </button></div><!--teleport anchor-->"')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders pure components', async () => {
|
it('renders pure components', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user