MCPcopy Create free account
hub / github.com/TanStack/db / createDefaultCollection

Function createDefaultCollection

packages/offline-transactions/tests/harness.ts:106–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104}
105
106function createDefaultCollection(): {
107 collection: Collection<TestItem, string, {}>
108 controller: SyncController
109} {
110 let controller!: SyncController
111
112 const collection = createCollection<TestItem, string, {}>({
113 id: `test-items`,
114 getKey: (item) => item.id,
115 startSync: true,
116 sync: {
117 sync: (params) => {
118 controller = {
119 begin: params.begin,
120 write: params.write,
121 commit: params.commit,
122 markReady: params.markReady,
123 }
124 params.markReady()
125 },
126 },
127 })
128
129 return { collection, controller }
130}
131
132export function createTestOfflineEnvironment(
133 options: TestOfflineEnvironmentOptions = {},

Callers 1

Calls 2

createCollectionFunction · 0.90
markReadyMethod · 0.80

Tested by

no test coverage detected