MCPcopy Index your code
hub / github.com/TanStack/db / assertNotLoaded

Function assertNotLoaded

packages/db-collection-e2e/src/utils/assertions.ts:59–73  ·  view source on GitHub ↗
(
  collection: Collection<T>,
  forbiddenIds: Array<string>,
  message?: string,
)

Source from the content-addressed store, hash-verified

57 * Assert that a collection has NOT loaded any of the specified items
58 */
59export function assertNotLoaded<T extends { id: string }>(
60 collection: Collection<T>,
61 forbiddenIds: Array<string>,
62 message?: string,
63) {
64 const loadedIds = getLoadedIds(collection)
65 const loadedSet = new Set(loadedIds)
66
67 const foundIds = forbiddenIds.filter((id) => loadedSet.has(id))
68 if (foundIds.length > 0) {
69 throw new Error(
70 message ?? `Collection should not have loaded: ${foundIds.join(`, `)}`,
71 )
72 }
73}
74
75/**
76 * Assert that a collection's size matches expected

Callers

nothing calls this directly

Calls 4

getLoadedIdsFunction · 0.90
filterMethod · 0.80
hasMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…