forked from eatvio/eatvio_app
feat(personalized_feed): added fixtures for new feed, added new feed parsing and layout, added webview player for post videos
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import '../../../fixtures/feed_fixtures.dart';
|
||||
import 'feed_service_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<FeedService>()])
|
||||
@@ -55,6 +56,32 @@ void main() {
|
||||
verify(mockFeedService.getBlogPostList(page: page, query: null)).called(1);
|
||||
});
|
||||
|
||||
test('getFeed returns cursor response', () async {
|
||||
final expected = FeedFixtures.postFeedPaginationModel();
|
||||
|
||||
when(mockFeedService.getFeed(search: null, cursor: null)).thenAnswer((_) async => expected);
|
||||
|
||||
final result = await mockFeedService.getFeed(search: null, cursor: null);
|
||||
|
||||
expect(result.data, hasLength(3));
|
||||
expect(result.meta.perPage, 20);
|
||||
expect(result.meta.nextCursor, 'eyJpZCI6MTAzfQ');
|
||||
verify(mockFeedService.getFeed(search: null, cursor: null)).called(1);
|
||||
});
|
||||
|
||||
test('getFeed returns next page without cursor', () async {
|
||||
const cursor = 'eyJpZCI6MTAzfQ';
|
||||
final expected = FeedFixtures.postFeedNextPagePaginationModel();
|
||||
|
||||
when(mockFeedService.getFeed(search: null, cursor: cursor)).thenAnswer((_) async => expected);
|
||||
|
||||
final result = await mockFeedService.getFeed(search: null, cursor: cursor);
|
||||
|
||||
expect(result.data, hasLength(1));
|
||||
expect(result.meta.nextCursor, isNull);
|
||||
verify(mockFeedService.getFeed(search: null, cursor: cursor)).called(1);
|
||||
});
|
||||
|
||||
test('getBlogPost returns post', () async {
|
||||
const id = 10;
|
||||
final expected = FeedBlogPostModel(
|
||||
|
||||
Reference in New Issue
Block a user