Skip to content

Commit

Permalink
Try to reproduce
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Jun 13, 2024
1 parent 510a4fa commit 2aea4e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions packages/realm_dart/test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:crypto/crypto.dart';
import 'package:http/http.dart';
import 'package:path/path.dart' as path;
import 'package:realm_dart/realm.dart';
import 'package:realm_dart/src/configuration.dart';
import 'package:realm_dart/src/handles/realm_core.dart';

import 'test.dart';
Expand Down Expand Up @@ -379,6 +380,20 @@ void main() {
expect(log, contains('App constructor called on Isolate'));
});

baasTest('boom', (appConfig) async {
for (var i = 0; i < 100; i++) {
await Isolate.run(() async {
print(i);
clearCachedApps();
final app = App(appConfig);
final user = await app.logIn(Credentials.anonymous());
final config = Configuration.flexibleSync(user, getSyncSchema());
final realm = getRealm(config, stopPolicy: SessionStopPolicy.afterChangesUploaded);
realm.close();
});
}
});

test('AppConfiguration(empty-id) throws', () {
expect(() => AppConfiguration(''), throwsA(isA<RealmException>()));
});
Expand Down
4 changes: 2 additions & 2 deletions packages/realm_dart/test/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ String generateRandomEmail({int length = 5}) {
return "$randomString@realm.io";
}

Realm getRealm(Configuration config) {
Realm getRealm(Configuration config, {SessionStopPolicy stopPolicy = SessionStopPolicy.immediately}) {
if (config is FlexibleSyncConfiguration) {
config.sessionStopPolicy = SessionStopPolicy.immediately;
config.sessionStopPolicy = stopPolicy;
}

final realm = Realm(config);
Expand Down

0 comments on commit 2aea4e0

Please sign in to comment.