mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
test: await before asserting console logs (#24051)
This commit is contained in:
parent
d7b1116443
commit
dce8ebb336
@ -1200,6 +1200,8 @@ describe('nested suspense', () => {
|
||||
const first = start.match(/\/suspense\/(?<parentType>a?sync)-(?<parentNum>\d)\/(?<childType>a?sync)-(?<childNum>\d)\//)!.groups!
|
||||
const last = nav.match(/\/suspense\/(?<parentType>a?sync)-(?<parentNum>\d)\//)!.groups!
|
||||
|
||||
await new Promise<void>(resolve => setTimeout(resolve, 50))
|
||||
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
// [first load] from parent
|
||||
`[${first.parentType}]`,
|
||||
|
@ -3,7 +3,7 @@ if (import.meta.client) {
|
||||
console.log('[async] [async]')
|
||||
}
|
||||
const route = useRoute('suspense-async-parent-async-child')
|
||||
await new Promise(resolve => setTimeout(resolve, 500))
|
||||
await new Promise(resolve => setTimeout(resolve, 50))
|
||||
if (import.meta.client) {
|
||||
console.log(`[async] [${route.params.parent}] [async] [${route.params.child}] running async data`)
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ if (import.meta.client) {
|
||||
console.log('[sync] [async]')
|
||||
}
|
||||
const route = useRoute('suspense-async-parent-sync-child')
|
||||
await new Promise(resolve => setTimeout(resolve, 500))
|
||||
await new Promise(resolve => setTimeout(resolve, 50))
|
||||
if (import.meta.client) {
|
||||
console.log(`[sync] [${route.params.parent}] [async] [${route.params.child}] running async data`)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user