From 80a80edbc2e0ccfd59069cd0fad928e90bc442e8 Mon Sep 17 00:00:00 2001 From: Jan Hug Date: Tue, 15 Aug 2023 08:22:21 +0200 Subject: [PATCH] Fix race condition in test --- playground/app/multiCache.serverOptions.ts | 2 +- test/spaMode.test.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/playground/app/multiCache.serverOptions.ts b/playground/app/multiCache.serverOptions.ts index 17fdefb..5b8b4de 100644 --- a/playground/app/multiCache.serverOptions.ts +++ b/playground/app/multiCache.serverOptions.ts @@ -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 = {} diff --git a/test/spaMode.test.ts b/test/spaMode.test.ts index e3ada61..043f0f2 100644 --- a/test/spaMode.test.ts +++ b/test/spaMode.test.ts @@ -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 = { @@ -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') }) })