forked from eatvio/eatvio_app
feat(tests): updated tests coverage to 66.5%
This commit is contained in:
@@ -60,6 +60,32 @@ void main() {
|
||||
expect(state.isLoading, isFalse);
|
||||
expect(state.error, isNull);
|
||||
});
|
||||
|
||||
test('toJson serializes BlogPostState correctly', () {
|
||||
final state = BlogPostState(
|
||||
blogPostModel: null,
|
||||
isLoading: false,
|
||||
error: null,
|
||||
);
|
||||
|
||||
final json = state.toJson();
|
||||
|
||||
expect(json['isLoading'], isFalse);
|
||||
expect(json['error'], isNull);
|
||||
expect(json.containsKey('blogPostModel'), isTrue);
|
||||
});
|
||||
|
||||
test('copyWith creates new instance with updated values', () {
|
||||
final original = BlogPostState();
|
||||
final updated = original.copyWith(
|
||||
isLoading: true,
|
||||
error: 'Test error',
|
||||
);
|
||||
|
||||
expect(updated.isLoading, isTrue);
|
||||
expect(updated.error, 'Test error');
|
||||
expect(updated.blogPostModel, original.blogPostModel);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user