MCPcopy Create free account
hub / github.com/denoland/std / assertEntries

Function assertEntries

cache/ttl_cache_test.ts:9–23  ·  view source on GitHub ↗
(
  cache: TtlCache<K, V>,
  entries: [key: K, value: V | typeof UNSET][],
)

Source from the content-addressed store, hash-verified

7
8// check `has()`, `get()`, `forEach()`
9function assertEntries<K, V>(
10 cache: TtlCache<K, V>,
11 entries: [key: K, value: V | typeof UNSET][],
12) {
13 for (const [key, value] of entries) {
14 assertEquals(cache.has(key), value !== UNSET);
15 assertEquals(cache.get(key), value === UNSET ? undefined : value);
16 }
17
18 cache.forEach((v, k) => assertEquals(v, entries.find(([x]) => x === k)![1]));
19 assertContentfulEntries(
20 cache as TtlCache<K, V | typeof UNSET>,
21 entries.filter(([, v]) => v !== UNSET),
22 );
23}
24
25// check `size`, `entries()`, `keys()`, `values()`, `[Symbol.iterator]()`
26function assertContentfulEntries<K, V>(

Callers 1

ttl_cache_test.tsFile · 0.85

Calls 6

assertEqualsFunction · 0.90
assertContentfulEntriesFunction · 0.85
forEachMethod · 0.80
hasMethod · 0.65
getMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected