chore: prefer image and name property on image

This commit is contained in:
Gordon Hayes
2021-08-10 10:00:02 +02:00
parent eae7cb1020
commit ae8ebe2dba
2 changed files with 22 additions and 32 deletions
@@ -13,10 +13,11 @@ void main() {
expect(reaction.type, 'wow'); expect(reaction.type, 'wow');
expect( expect(
reaction.user?.toJson(), reaction.user?.toJson(),
User(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: const { User(
'image': 'https://randomuser.me/api/portraits/women/45.jpg', id: '2de0297c-f3f2-489d-b930-ef77342edccf',
'name': 'Daisy Morgan' image: 'https://randomuser.me/api/portraits/women/45.jpg',
}).toJson(), name: 'Daisy Morgan',
).toJson(),
); );
expect(reaction.score, 1); expect(reaction.score, 1);
expect(reaction.userId, '2de0297c-f3f2-489d-b930-ef77342edccf'); expect(reaction.userId, '2de0297c-f3f2-489d-b930-ef77342edccf');
@@ -28,11 +29,11 @@ void main() {
messageId: '76cd8c82-b557-4e48-9d12-87995d3a0e04', messageId: '76cd8c82-b557-4e48-9d12-87995d3a0e04',
createdAt: DateTime.parse('2020-01-28T22:17:31.108742Z'), createdAt: DateTime.parse('2020-01-28T22:17:31.108742Z'),
type: 'wow', type: 'wow',
user: user: User(
User(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: const { id: '2de0297c-f3f2-489d-b930-ef77342edccf',
'image': 'https://randomuser.me/api/portraits/women/45.jpg', image: 'https://randomuser.me/api/portraits/women/45.jpg',
'name': 'Daisy Morgan' name: 'Daisy Morgan',
}), ),
userId: '2de0297c-f3f2-489d-b930-ef77342edccf', userId: '2de0297c-f3f2-489d-b930-ef77342edccf',
extraData: {'bananas': 'yes'}, extraData: {'bananas': 'yes'},
score: 1, score: 1,
@@ -58,10 +59,11 @@ void main() {
expect(newReaction.type, 'wow'); expect(newReaction.type, 'wow');
expect( expect(
newReaction.user?.toJson(), newReaction.user?.toJson(),
User(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: const { User(
'image': 'https://randomuser.me/api/portraits/women/45.jpg', id: '2de0297c-f3f2-489d-b930-ef77342edccf',
'name': 'Daisy Morgan', image: 'https://randomuser.me/api/portraits/women/45.jpg',
}).toJson(), name: 'Daisy Morgan',
).toJson(),
); );
expect(newReaction.score, 1); expect(newReaction.score, 1);
expect(newReaction.userId, '2de0297c-f3f2-489d-b930-ef77342edccf'); expect(newReaction.userId, '2de0297c-f3f2-489d-b930-ef77342edccf');
@@ -48,7 +48,7 @@ void main() {
); );
testWidgets( testWidgets(
'it should show the the other member image', 'it should show the other member image',
(tester) async { (tester) async {
final client = MockClient(); final client = MockClient();
final clientState = MockClientState(); final clientState = MockClientState();
@@ -74,9 +74,7 @@ void main() {
userId: 'user-id2', userId: 'user-id2',
user: User( user: User(
id: 'user-id2', id: 'user-id2',
extraData: const { image: 'testimage',
'image': 'testimage',
},
), ),
) )
])); ]));
@@ -85,9 +83,7 @@ void main() {
userId: 'user-id2', userId: 'user-id2',
user: User( user: User(
id: 'user-id2', id: 'user-id2',
extraData: const { image: 'testimage',
'image': 'testimage',
},
), ),
), ),
Member( Member(
@@ -98,9 +94,7 @@ void main() {
when(() => clientState.usersStream).thenAnswer((i) => Stream.value({ when(() => clientState.usersStream).thenAnswer((i) => Stream.value({
'user-id2': User( 'user-id2': User(
id: 'user-id2', id: 'user-id2',
extraData: const { image: 'testimage',
'image': 'testimage',
},
), ),
})); }));
when(() => channel.extraData).thenReturn({ when(() => channel.extraData).thenReturn({
@@ -149,27 +143,21 @@ void main() {
userId: 'user-id', userId: 'user-id',
user: User( user: User(
id: 'user-id', id: 'user-id',
extraData: const { image: 'testimage1',
'image': 'testimage1',
},
), ),
), ),
Member( Member(
userId: 'user-id2', userId: 'user-id2',
user: User( user: User(
id: 'user-id2', id: 'user-id2',
extraData: const { image: 'testimage2',
'image': 'testimage2',
},
), ),
), ),
Member( Member(
userId: 'user-id3', userId: 'user-id3',
user: User( user: User(
id: 'user-id3', id: 'user-id3',
extraData: const { image: 'testimage3',
'image': 'testimage3',
},
), ),
), ),
]; ];