feat: implement client-side sync with bulk API

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-12 07:50:28 +00:00
parent 82c537d659
commit 73171b5f18
2 changed files with 89 additions and 4 deletions

View File

@@ -76,4 +76,31 @@ describe('HighlightSyncManager', () => {
const syncing = await manager.getSyncingItems()
expect(syncing.length).toBe(1)
})
it('should perform sync and mark items as synced', async () => {
const highlight: BibleHighlight = {
id: 'h-1',
verseId: 'v-1',
color: 'yellow',
createdAt: Date.now(),
updatedAt: Date.now(),
syncStatus: 'pending'
}
await manager.queueHighlight(highlight)
await manager.init()
// Mock fetch
global.fetch = jest.fn(() =>
Promise.resolve({
ok: true,
json: () => Promise.resolve({ synced: 1, errors: [] })
})
) as jest.Mock
const result = await manager.performSync()
expect(result.synced).toBe(1)
expect(result.errors).toBe(0)
})
})