(
initialDocs: Array<TestDocType> = [],
config: Partial<RxDBCollectionConfig<TestDocType, any>> = {},
)
| 76 | } |
| 77 | |
| 78 | async function createTestState( |
| 79 | initialDocs: Array<TestDocType> = [], |
| 80 | config: Partial<RxDBCollectionConfig<TestDocType, any>> = {}, |
| 81 | ) { |
| 82 | const db = await getDatababase(initialDocs, dbNameId++) |
| 83 | const rxCollection: RxCollection<TestDocType> = db.test |
| 84 | const options = rxdbCollectionOptions({ |
| 85 | rxCollection: rxCollection, |
| 86 | startSync: true, |
| 87 | /** |
| 88 | * In tests we use a small batch size |
| 89 | * to ensure iteration works. |
| 90 | */ |
| 91 | syncBatchSize: 10, |
| 92 | ...config, |
| 93 | }) |
| 94 | |
| 95 | const collection = createCollection(options) |
| 96 | await collection.stateWhenReady() |
| 97 | |
| 98 | return { |
| 99 | collection, |
| 100 | rxCollection, |
| 101 | db, |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | describe(`sync`, () => { |
| 106 | it(`should initialize and fetch initial data`, async () => { |
no test coverage detected