Skip to content

Commit a1d62a0

Browse files
committed
don't add test specific exports in runtime
1 parent 061e18b commit a1d62a0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/run/storage/request-scoped-in-memory-cache.cts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ function getInMemoryLRUCache() {
150150
return extendedGlobalThis[IN_MEMORY_LRU_CACHE]
151151
}
152152

153-
export function clearInMemoryLRUCacheForTesting() {
154-
extendedGlobalThis[IN_MEMORY_LRU_CACHE] = undefined
155-
}
156-
157153
interface RequestScopedInMemoryCache {
158154
get(key: string):
159155
| { conditional: false; currentRequestValue: BlobType | null | Promise<BlobType | null> }

src/run/storage/storage.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { decodeBlobKey } from '../../../tests/utils/helpers.ts'
66
import { BlobType } from '../../shared/blob-types.cts'
77
import { createRequestContext, runWithRequestContext } from '../handlers/request-context.cts'
88

9-
import { clearInMemoryLRUCacheForTesting } from './request-scoped-in-memory-cache.cts'
109
import { getMemoizedKeyValueStoreBackedByRegionalBlobStore } from './storage.cts'
1110

1211
function mockGenerateRecord(data: BlobType) {
@@ -77,7 +76,11 @@ function generate30MBBlobTypeValue(id: string): BlobType {
7776
}
7877

7978
beforeEach(() => {
80-
clearInMemoryLRUCacheForTesting()
79+
// reset in memory cache between tests
80+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
81+
const unTypedGlobalThis = globalThis as any
82+
unTypedGlobalThis[Symbol.for('nf-in-memory-lru-cache')] = undefined
83+
8184
mockBlobValues = {
8285
[TEST_KEY]: mockGenerateRecord(TEST_DEFAULT_VALUE),
8386
}

0 commit comments

Comments
 (0)