Skip to content

Commit

Permalink
Add a few more validations
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Dec 8, 2023
1 parent 5131de3 commit 196c1fb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/client_reset_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Future<void> main([List<String>? args]) async {

final onManualResetFallback = Completer<void>();
void onAfterReset(Realm beforeResetRealm, Realm afterResetRealm) {
throw Exception("This fails!");
throw Exception("This fails too!");
}

final config = Configuration.flexibleSync(user, getSyncSchema(),
Expand All @@ -194,7 +194,12 @@ Future<void> main([List<String>? args]) async {
await triggerClientReset(realm);

final clientResetFuture = onManualResetFallback.future.wait(defaultWaitTimeout, "onManualResetFallback is not reported.");
await expectLater(clientResetFuture, throws<ClientResetError>());
await expectLater(
clientResetFuture,
throwsA(isA<ClientResetError>().having((e) => e.innerError?.toString(), 'innerError', 'Exception: This fails too!').having(
(e) => e.toString(),
'message',
"ClientResetError message: A fatal error occurred during client reset: 'User-provided callback failed', inner error: 'Exception: This fails too!'")));
});

baasTest('$clientResetHandlerType.onBeforeReset and onAfterReset are invoked', (appConfig) async {
Expand Down Expand Up @@ -469,6 +474,8 @@ Future<void> main([List<String>? args]) async {
expect(onBeforeResetOccurred, 1);

expect(clientResetErrorOnManualFallback.message, isNotEmpty);
expect(clientResetErrorOnManualFallback.innerError, isNotNull);
expect(clientResetErrorOnManualFallback.innerError.toString(), 'Exception: Cause onManualResetFallback');
});

// 1. userA adds [task0, task1, task2] and syncs it, then disconnects
Expand Down

0 comments on commit 196c1fb

Please sign in to comment.