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:
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user