test(llc): fix user, own_user tests

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2022-05-20 15:43:40 +05:30
committed by xsahil03x
parent 180e4475d2
commit 89a3d09478
3 changed files with 13 additions and 5 deletions
@@ -41,7 +41,8 @@ class OwnUser extends User {
factory OwnUser.fromUser(User user) => OwnUser( factory OwnUser.fromUser(User user) => OwnUser(
id: user.id, id: user.id,
role: user.role, role: user.role,
name: user.name, // Using extraData value in order to not use id as name.
name: user.extraData['name'] as String?,
image: user.image, image: user.image,
createdAt: user.createdAt, createdAt: user.createdAt,
updatedAt: user.updatedAt, updatedAt: user.updatedAt,
@@ -78,7 +79,10 @@ class OwnUser extends User {
OwnUser( OwnUser(
id: id ?? this.id, id: id ?? this.id,
role: role ?? this.role, role: role ?? this.role,
name: name ?? extraData?['name'] as String? ?? this.name, name: name ??
extraData?['name'] as String? ??
// Using extraData value in order to not use id as name.
this.extraData['name'] as String?,
image: image ?? extraData?['image'] as String? ?? this.image, image: image ?? extraData?['image'] as String? ?? this.image,
banned: banned ?? this.banned, banned: banned ?? this.banned,
banExpires: banExpires ?? this.banExpires, banExpires: banExpires ?? this.banExpires,
@@ -103,7 +107,8 @@ class OwnUser extends User {
return copyWith( return copyWith(
id: other.id, id: other.id,
role: other.role, role: other.role,
name: other.name, // Using extraData value in order to not use id as name.
name: other.extraData['name'] as String?,
image: other.image, image: other.image,
banned: other.banned, banned: other.banned,
channelMutes: other.channelMutes, channelMutes: other.channelMutes,
@@ -172,7 +172,10 @@ class User extends Equatable {
User( User(
id: id ?? this.id, id: id ?? this.id,
role: role ?? this.role, role: role ?? this.role,
name: name ?? extraData?['name'] as String? ?? this.name, name: name ??
extraData?['name'] as String? ??
// Using extraData value in order to not use id as name.
this.extraData['name'] as String?,
image: image ?? extraData?['image'] as String? ?? this.image, image: image ?? extraData?['image'] as String? ?? this.image,
createdAt: createdAt ?? this.createdAt, createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt, updatedAt: updatedAt ?? this.updatedAt,
@@ -2514,7 +2514,7 @@ void main() {
}); });
test( test(
'''setting the `currentUser` should also compute and update the unreadCounts''', 'setting the `currentUser` should also compute and update the unreadCounts',
() { () {
final state = client.state; final state = client.state;
final initialUser = OwnUser.fromUser(user); final initialUser = OwnUser.fromUser(user);