()
| 24 | |
| 25 | describe(`On-Demand Sync Mode`, () => { |
| 26 | async function createDatabase() { |
| 27 | const db = new PowerSyncDatabase({ |
| 28 | database: { |
| 29 | dbFilename: `test-on-demand-${randomUUID()}.sqlite`, |
| 30 | dbLocation: tmpdir(), |
| 31 | implementation: { type: `node:sqlite` }, |
| 32 | }, |
| 33 | schema: APP_SCHEMA, |
| 34 | }) |
| 35 | onTestFinished(async () => { |
| 36 | // Wait a moment for any pending cleanup operations to complete |
| 37 | // before closing the database to prevent "operation on closed remote" errors |
| 38 | await new Promise((resolve) => setTimeout(resolve, 100)) |
| 39 | await db.disconnectAndClear() |
| 40 | await db.close() |
| 41 | }) |
| 42 | await db.disconnectAndClear() |
| 43 | return db |
| 44 | } |
| 45 | |
| 46 | async function createTestProducts(db: PowerSyncDatabase) { |
| 47 | await db.execute(` |
no test coverage detected