Skip to content

Commit 84d6af3

Browse files
VelikovPetarclaude
andcommitted
test(persistence): Toggle online to force state change in user upsert test
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e5282c4 commit 84d6af3

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/stream_chat_persistence/test/src/dao/user_dao_test.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ void main() {
5959
final insertedUsers = await _prepareUserData();
6060

6161
// Modifying one of the users and also adding one new
62-
final copyUser = insertedUsers.first.copyWith(online: false);
62+
final copyUser =
63+
insertedUsers.first.copyWith(online: !insertedUsers.first.online);
6364
final newUser = User(
6465
id: 'testUserId3',
6566
role: 'testRole',
@@ -72,11 +73,14 @@ void main() {
7273
await userDao.updateUsers([copyUser, newUser]);
7374

7475
// Fetched users length should be one more than inserted users.
75-
// copyUser `online` modified field should be `false`.
76+
// copyUser `online` should match the toggled value.
7677
// Fetched users should contain the newUser.
7778
final fetchedUsers = await _readPersistedUsers();
7879
expect(fetchedUsers.length, insertedUsers.length + 1);
79-
expect(fetchedUsers.firstWhere((it) => it.id == copyUser.id).online, false);
80+
expect(
81+
fetchedUsers.firstWhere((it) => it.id == copyUser.id).online,
82+
copyUser.online,
83+
);
8084
expect(fetchedUsers.any((it) => it.id == newUser.id), isTrue);
8185
});
8286

0 commit comments

Comments
 (0)