* Helper to create a collection that's ready for testing. * Handles all the boilerplate setup: preload, begin, commit, markReady.
(opts: {
id: string
getKey: (item: T) => string | number
})
| 18 | * Handles all the boilerplate setup: preload, begin, commit, markReady. |
| 19 | */ |
| 20 | async function createReadyCollection<T extends object>(opts: { |
| 21 | id: string |
| 22 | getKey: (item: T) => string | number |
| 23 | }) { |
| 24 | const collection = createCollection( |
| 25 | mockSyncCollectionOptionsNoInitialState<T>(opts), |
| 26 | ) |
| 27 | |
| 28 | const preloadPromise = collection.preload() |
| 29 | collection.utils.begin() |
| 30 | collection.utils.commit() |
| 31 | collection.utils.markReady() |
| 32 | await preloadPromise |
| 33 | |
| 34 | return collection |
| 35 | } |
| 36 | |
| 37 | describe(`createPacedMutations`, () => { |
| 38 | describe(`with debounce strategy`, () => { |
nothing calls this directly
no test coverage detected
searching dependent graphs…