Skip to content

Commit

Permalink
Fixes PalisadoesFoundation#1420 Models: Tests for event_model.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush0Chaudhary committed Jan 31, 2023
1 parent 9a300d4 commit 2736289
Showing 1 changed file with 48 additions and 18 deletions.
66 changes: 48 additions & 18 deletions test/model_tests/events/event_model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void main() {

final eventJson = {
'creator': {
'id': '123',
'_id': '123',
'firstName': 'Ayush',
'lastName': 'Chaudhary',
'email': '[email protected]',
Expand All @@ -64,39 +64,69 @@ void main() {
'isPublic': true,
'isRegistered': true,
'isRegisterable': true,
'organization': {'admin': {}},
'organization': {
'admin': {
'id': '123',
'firstName': 'Ayush',
'lastName': 'Chaudhary',
'email': '[email protected]',
},
},
'admins': [
{
<String, dynamic>{
'id': '123',
'firstName': 'Ayush',
'lastName': 'Chaudhary',
'email': '[email protected]',
},
{
<String, dynamic>{
'id': '123',
'firstName': 'Aykkush',
'lastName': 'Chaudhary',
'email': '[email protected]',
},
],
'registrants': [
{
{'id': "fakeUser1"},
{'id': "fakeUser2"}
}
]
<String, dynamic>{
'user': {
'id': '123',
'firstName': 'Ayush',
'lastName': 'Chaudhary',
'email': '[email protected]',
}
},
<String, dynamic>{
'user': {
'id': '123',
'firstName': 'Aykkush',
'lastName': 'Chaudhary',
'email': '[email protected]',
}
},
],
};
final eventFromJson = Event.fromJson(eventJson);

// final commentFromJson = Comment.fromJson(commentJson);
// expect(comment.creator?.id, commentFromJson.creator?.id);
// expect(comment.creator?.firstName, commentFromJson.creator?.firstName);
// expect(comment.creator?.lastName, commentFromJson.creator?.lastName);
// expect(comment.creator?.email, commentFromJson.creator?.email);
// expect(comment.createdAt, commentFromJson.createdAt);
// expect(comment.text, commentFromJson.text);
// expect(comment.post, commentFromJson.post);
// expect(comment.likeCount, commentFromJson.likeCount);
expect(event.creator?.id, eventFromJson.creator?.id);
expect(event.creator?.firstName, eventFromJson.creator?.firstName);
expect(event.creator?.lastName, eventFromJson.creator?.lastName);
expect(event.creator?.email, eventFromJson.creator?.email);
expect(event.title, eventFromJson.title);
expect(event.id, eventFromJson.id);
expect(event.description, eventFromJson.description);
expect(event.attendees, eventFromJson.attendees);
expect(event.location, eventFromJson.location);
expect(event.latitude, eventFromJson.latitude);
expect(event.longitude, eventFromJson.longitude);
expect(event.recurring, eventFromJson.recurring);
expect(event.allDay, eventFromJson.allDay);
expect(event.startDate, eventFromJson.startDate);
expect(event.startTime, eventFromJson.startTime);
expect(event.endTime, eventFromJson.endTime);
expect(event.recurrence, eventFromJson.recurrence);
expect(event.isPublic, eventFromJson.isPublic);
expect(event.isRegistered, eventFromJson.isRegistered);
expect(event.isRegisterable, eventFromJson.isRegisterable);
});
});
}

0 comments on commit 2736289

Please sign in to comment.