Skip to content

Commit

Permalink
Don't test on exception text (use ClientResetError.code)
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Jun 12, 2024
1 parent 483e2b7 commit 182d7ca
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/realm_dart/test/client_reset_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ void main() {

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

baasTest('$clientResetHandlerType.onManualResetFallback invoked when throw in onAfterReset', (appConfig) async {
Expand All @@ -173,11 +173,9 @@ void main() {

final clientResetFuture = onManualResetFallback.future.wait(defaultWaitTimeout, "onManualResetFallback is not reported.");
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!'")));
clientResetFuture,
throwsA(isA<ClientResetError>().having((e) => e.code, 'code', SyncErrorCode.autoClientResetFailed)),
);
});

baasTest('$clientResetHandlerType.onBeforeReset and onAfterReset are invoked', (appConfig) async {
Expand Down

0 comments on commit 182d7ca

Please sign in to comment.