Skip to content

Commit

Permalink
user equals operator uses user.id to compare users (realm#603)
Browse files Browse the repository at this point in the history
* user equals operator uses user.id to compare users

* add todo
  • Loading branch information
blagoev authored May 23, 2022
1 parent fde064c commit 5ed3a93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/src/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class User {
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (other is! User) return false;
return realmCore.userEquals(this, other);
//TODO: use realm_equals when https://github.com/realm/realm-core/issues/5522 is fixed
return id == other.id;
}
}

Expand Down
3 changes: 1 addition & 2 deletions test/user_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
////////////////////////////////////////////////////////////////////////////////
import 'dart:io';
import 'dart:math';

import 'package:test/expect.dart';

Expand Down Expand Up @@ -90,7 +89,7 @@ Future<void> main([List<String>? args]) async {
expect(user1.identities.singleWhere((identity) => identity.provider == AuthProviderType.anonymous).provider, isNotNull);

final user2 = await app.logIn(Credentials.emailPassword(username, password));
expect(user1.id, equals(user2.id));
expect(user1, user2);
}, appName: AppNames.autoConfirm);

baasTest('User deviceId', (configuration) async {
Expand Down

0 comments on commit 5ed3a93

Please sign in to comment.