Skip to content

Commit

Permalink
Adapt test to changed semantics wrt. progress notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Apr 30, 2024
1 parent e2ede42 commit 5a9dd05
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/realm_dart/test/realm_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1328,17 +1328,18 @@ void main() {
final user = await app.logIn(credentials);
final configuration = Configuration.flexibleSync(user, getSyncSchema());

int count = 0;
double progress = -1;
final completer = Completer<void>();

var syncedRealm = await getRealmAsync(configuration, onProgressCallback: (syncProgress) {
count++;
progress = syncProgress.progressEstimate;
if (syncProgress.progressEstimate == 1.0) {
completer.complete();
}
});
completer.future.timeout(Duration(milliseconds: 300), onTimeout: () => throw Exception("onProgressCallback did not happen."));

expect(syncedRealm.isClosed, false);
expect(progress, greaterThan(-1));
// Semantics of onProgressCallback changed with https://github.com/realm/realm-core/issues/7452
expect(count, 0);
expect(progress, -1);
});

baasTest('Realm.open (flexibleSync) - download a populated realm', (appConfiguration) async {
Expand Down

0 comments on commit 5a9dd05

Please sign in to comment.