Add background sync runner and rejected-sync UX
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user