Skip to content

Commit

Permalink
Fix race condition in test
Browse files Browse the repository at this point in the history
  • Loading branch information
dulnan committed Aug 15, 2023
1 parent e1a8d35 commit 80a80ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion playground/app/multiCache.serverOptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineDriver } from 'unstorage'
import { H3Event, getQuery, getHeader } from 'h3'
import { defineMultiCacheOptions } from './../../src/module'
import { defineMultiCacheOptions } from './../../dist/runtime/serverOptions'

const customDriver = defineDriver(() => {
let cache: Record<string, string> = {}
Expand Down
4 changes: 3 additions & 1 deletion test/spaMode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { describe, expect, test } from 'vitest'
import { NuxtMultiCacheOptions } from '../src/runtime/types'
import purgeAll from './__helpers__/purgeAll'
import purgeByKey from './__helpers__/purgeByKey'
import { sleep } from './__helpers__'

describe('In SPA mode', async () => {
const multiCache: NuxtMultiCacheOptions = {
Expand Down Expand Up @@ -56,7 +57,8 @@ describe('In SPA mode', async () => {
await purgeAll()

const page = await createPage('/spaDataCache')
await sleep(1000)
const text = await page.locator('#data-cache-value').innerText()
expect(text).toEqual('Success.')
expect(text).toEqual('Success')
})
})

0 comments on commit 80a80ed

Please sign in to comment.