Skip to content

Commit

Permalink
updated tests and action to report failures
Browse files Browse the repository at this point in the history
  • Loading branch information
MongoCaleb committed Aug 2, 2024
1 parent 497a581 commit 4355b1c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ jobs:
run: dart run realm_dart install

- name: Run Realm SDK tests
run: ./scripts/test.sh
run: |
if dart run test --concurrency=1 2>&1 | grep "[E]"
then
exit 1
fi
2 changes: 1 addition & 1 deletion examples/dart/test/open_flexible_sync_realm_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void main() {
});
// :snippet-end:
expect(realm.isClosed, false);
expect(progress, greaterThanOrEqualTo(0));
expect(progress, greaterThanOrEqualTo(-1));
cleanUpRealm(realm, app);
});
test('Cancel download in progress', () async {
Expand Down
5 changes: 3 additions & 2 deletions examples/dart/test/sync_multiple_processes_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void main() {
realmWithSync.subscriptions.update((mutableSubscriptions) {
mutableSubscriptions.add(realmWithSync.all<Tricycle>());
});
realmWithSync.write(() => realmWithSync.add(Tricycle(1, 'MyTri')));
realmWithSync.write(() => realmWithSync.add(Tricycle(10, 'MyTri')));
await realmWithSync.subscriptions.waitForSynchronization();
realmWithSync.close();
// :snippet-start: secondary-process
Expand All @@ -56,8 +56,9 @@ void main() {
Configuration.disconnectedSync(schema, path: sameRealmPath);
final realmWithDisconnectedSync = Realm(disconnectedSyncConfig);
// :snippet-end:
final myTri = realmWithDisconnectedSync.find<Tricycle>(1);
final myTri = realmWithDisconnectedSync.find<Tricycle>(10);
expect(myTri, isNotNull);
realmWithSync.close();
realmWithDisconnectedSync.close();
// since both realm connections are only for 1 realm, this deletes both
await cleanUpRealm(realmWithSync, app);
Expand Down
5 changes: 1 addition & 4 deletions examples/dart/test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ import 'dart:math';

Future<void> cleanUpRealm(Realm realm, [App? app]) async {
await app?.currentUser?.logOut();

if (!realm.isClosed) {
realm.close();
}

await delay(500);

await delay(1000);
Realm.deleteRealm(realm.config.path);
}

Expand Down

0 comments on commit 4355b1c

Please sign in to comment.