Add background sync runner and rejected-sync UX

This commit is contained in:
Rijad Zuzo
2026-02-15 20:13:12 +01:00
parent add0105e6b
commit 497805ed3b
8 changed files with 361 additions and 2 deletions
@@ -70,6 +70,43 @@ void main() {
expect(state.lastError, contains('Push rejected'));
},
);
test(
'clearRejections removes last rejected payload and rejection error',
() async {
final ProviderContainer container = ProviderContainer(
overrides: [
syncStateStoreProvider.overrideWithValue(InMemorySyncStateStore()),
],
);
addTearDown(container.dispose);
final SyncQueueRepository notifier = container.read(
syncQueueRepositoryProvider.notifier,
);
await notifier.enqueue(_change(id: 'p-1', mutationId: 'cm-r'));
await notifier.applyPushResult(
SyncPushResult(
cursor: 'cursor-3',
accepted: const <MutationAck>[],
rejected: const <MutationRejection>[
MutationRejection(
clientMutationId: 'cm-r',
code: 'VALIDATION_FAILED',
message: 'invalid payload',
),
],
),
at: DateTime(2026, 2, 15, 13),
);
await notifier.clearRejections();
final SyncStateData state = await _readState(container);
expect(state.rejected, isEmpty);
expect(state.lastError, isNull);
},
);
}
class SyncStateData {