Skip to content

Commit

Permalink
Add test with data
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsreichardt committed Mar 8, 2024
1 parent c40aed1 commit 0106a5d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app/test/feedback/feedback_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:sharezone/feedback/src/models/user_feedback.dart';

void main() {
group(FeedbackView, () {
test('.fromUserFeedback()', () {
test('.fromUserFeedback() empty', () {
final feedback = UserFeedback.create();
final view = FeedbackView.fromUserFeedback(feedback);

Expand All @@ -24,6 +24,24 @@ void main() {
expect(view.createdOn, isNull);
});

test('.fromUserFeedback() with data', () {
final feedback = UserFeedback.create().copyWith(
rating: 5.0,
dislikes: 'd',
heardFrom: 'h',
likes: 'l',
missing: 'm',
);
final view = FeedbackView.fromUserFeedback(feedback);

expect(view.rating, '5.0/5.0');
expect(view.likes, 'l');
expect(view.dislikes, 'd');
expect(view.heardFrom, 'h');
expect(view.missing, 'm');
expect(view.createdOn, isNull);
});

test('.hasX returns null even it is empty', () {
const view = FeedbackView(
createdOn: '',
Expand Down

0 comments on commit 0106a5d

Please sign in to comment.