fix: ky caching during tests

Travis Fischer 2023-06-23 15:07:19 -07:00
rodzic 3a6fc532d0
commit 2c1266d277
1 zmienionych plików z 3 dodań i 3 usunięć

6
test/_utils.ts vendored
Wyświetl plik

@ -92,6 +92,7 @@ export function createTestKyInstance(
}
if (!(await keyv.has(cacheKey))) {
// console.log('cache miss', cacheKey)
return
}
@ -137,19 +138,18 @@ export function createTestKyInstance(
return
}
if (contentType !== 'application/json') {
if (!contentType?.includes('application/json')) {
return
}
const cacheKey = getCacheKeyForRequest(request)
// console.log({ cacheKey })
if (!cacheKey) {
console.log('222')
return
}
const responseBody = await response.json()
// console.log({ responseBody })
// console.log({ cacheKey, responseBody })
await keyv.set(cacheKey, responseBody)
} catch (err) {