fix(llc): Connecting user without providing name uses id instead for setting user.name.

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2021-09-21 18:25:21 +05:30
committed by xsahil03x
parent 8cb95cfd7c
commit 403d0e62a0
3 changed files with 25 additions and 5 deletions
@@ -175,5 +175,26 @@ void main() {
expect(newUser.teams, ['team1', 'team2']);
expect(newUser.language, 'fr');
});
test(
'fromUser should not override name with id if not available in extraData',
() {
final user = User(id: 'test-id');
expect(user.id, 'test-id');
expect(user.name, 'test-id');
final encodedUser = user.toJson();
expect(encodedUser['id'], 'test-id');
expect(encodedUser['name'], null);
final ownUser = OwnUser.fromUser(user);
expect(user.id, 'test-id');
expect(user.name, 'test-id');
final encodedOwnUser = ownUser.toJson();
expect(encodedOwnUser['id'], 'test-id');
expect(encodedOwnUser['name'], null);
},
);
});
}