MCPcopy Create free account
hub / github.com/Snapchat/Valdi / cacheIt

Function cacheIt

compiler/companion/src/cache/SQLiteCompilationCache.spec.ts:16–30  ·  view source on GitHub ↗
(
    name: string,
    cb: (cache: SQLiteCompilationCache, timestampProvider: TestTimestampProvider) => Promise<void>,
  )

Source from the content-addressed store, hash-verified

14
15describe('SQLiteCompilationCache', () => {
16 function cacheIt(
17 name: string,
18 cb: (cache: SQLiteCompilationCache, timestampProvider: TestTimestampProvider) => Promise<void>,
19 ): void {
20 it(name, async () => {
21 const timestampProvider = new TestTimestampProvider();
22 const cache = SQLiteCompilationCache.newInMemoryInstance(timestampProvider);
23
24 try {
25 await cb(cache, timestampProvider);
26 } finally {
27 cache.close();
28 }
29 });
30 }
31
32 cacheIt('can insert and get values', async (cache) => {
33 let result = await cache.getCachedEntry('files', 'file.ts', 'xxx');

Callers 1

Calls 3

newInMemoryInstanceMethod · 0.80
closeMethod · 0.65
cbFunction · 0.50

Tested by

no test coverage detected