|
| 1 | +import 'package:http_interop/http_interop.dart' as i; |
| 2 | +import 'package:json_api/client.dart'; |
| 3 | +import 'package:json_api/src/client/response.dart'; |
| 4 | +import 'package:test/expect.dart'; |
| 5 | +import 'package:test/scaffolding.dart'; |
| 6 | + |
| 7 | +void main() { |
| 8 | + final emptyResponse = Response(i.Response(200, i.Body(), i.Headers()), null); |
| 9 | + group('CollectionFetched', () { |
| 10 | + test('throws on empty body', () { |
| 11 | + expect(() => CollectionFetched(emptyResponse), throwsFormatException); |
| 12 | + }); |
| 13 | + }); |
| 14 | + |
| 15 | + group('RelatedResourceFetched', () { |
| 16 | + test('throws on empty body', () { |
| 17 | + expect( |
| 18 | + () => RelatedResourceFetched(emptyResponse), throwsFormatException); |
| 19 | + }); |
| 20 | + }); |
| 21 | + |
| 22 | + group('RelationshipFetched', () { |
| 23 | + test('.many() throws on empty body', () { |
| 24 | + expect( |
| 25 | + () => RelationshipFetched.many(emptyResponse), throwsFormatException); |
| 26 | + }); |
| 27 | + |
| 28 | + test('.one() throws on empty body', () { |
| 29 | + expect( |
| 30 | + () => RelationshipFetched.one(emptyResponse), throwsFormatException); |
| 31 | + }); |
| 32 | + }); |
| 33 | + |
| 34 | + group('ResourceCreated', () { |
| 35 | + test('throws on empty body', () { |
| 36 | + expect(() => ResourceCreated(emptyResponse), throwsFormatException); |
| 37 | + }); |
| 38 | + }); |
| 39 | + |
| 40 | + group('ResourceFetched', () { |
| 41 | + test('throws on empty body', () { |
| 42 | + expect(() => ResourceFetched(emptyResponse), throwsFormatException); |
| 43 | + }); |
| 44 | + }); |
| 45 | +} |
0 commit comments