Skip to content

Commit

Permalink
test: use untilUpdated
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed May 4, 2023
1 parent 1e50e23 commit 54c023b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions playground/json/__tests__/ssr/json.spec.ts
@@ -1,6 +1,6 @@
import { beforeEach, expect, test } from 'vitest'
import { beforeEach, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'
import { page, untilUpdated } from '~utils'

const url = `http://localhost:${port}`

Expand All @@ -9,11 +9,12 @@ beforeEach(async () => {
})

test('load json module', async () => {
expect(await page.textContent('.fetch-json-module pre')).toBe(
await untilUpdated(
() => page.textContent('.fetch-json-module pre'),
'export default JSON.parse("{\\n \\"hello\\": \\"hi\\"\\n}\\n")',
)
})

test('fs json', async () => {
expect(await page.textContent('.fetch-json-fs pre')).toBe('61')
await untilUpdated(() => page.textContent('.fetch-json-fs pre'), '61')
})

0 comments on commit 54c023b

Please sign in to comment.