|
|
@ -38,18 +38,18 @@ Future main() async { |
|
|
|
expect(response.starredCount, null); |
|
|
|
expect(response.starredCount, null); |
|
|
|
expect(response.newestItemId, isNotNull); |
|
|
|
expect(response.newestItemId, isNotNull); |
|
|
|
expect(response.feeds, hasLength(1)); |
|
|
|
expect(response.feeds, hasLength(1)); |
|
|
|
expect(response.feeds![0].url, wikipediaFeedURL); |
|
|
|
expect(response.feeds[0].url, wikipediaFeedURL); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listFeeds(); |
|
|
|
response = await client.news.listFeeds(); |
|
|
|
expect(response.starredCount, 0); |
|
|
|
expect(response.starredCount, 0); |
|
|
|
expect(response.newestItemId, isNotNull); |
|
|
|
expect(response.newestItemId, isNotNull); |
|
|
|
expect(response.feeds, hasLength(1)); |
|
|
|
expect(response.feeds, hasLength(1)); |
|
|
|
expect(response.feeds![0].url, wikipediaFeedURL); |
|
|
|
expect(response.feeds[0].url, wikipediaFeedURL); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Rename feed', () async { |
|
|
|
test('Rename feed', () async { |
|
|
|
var response = await addWikipediaFeed(); |
|
|
|
var response = await addWikipediaFeed(); |
|
|
|
expect(response.feeds![0].title, 'Wikipedia featured articles feed'); |
|
|
|
expect(response.feeds[0].title, 'Wikipedia featured articles feed'); |
|
|
|
|
|
|
|
|
|
|
|
await client.news.renameFeed( |
|
|
|
await client.news.renameFeed( |
|
|
|
feedId: 1, |
|
|
|
feedId: 1, |
|
|
@ -57,7 +57,7 @@ Future main() async { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listFeeds(); |
|
|
|
response = await client.news.listFeeds(); |
|
|
|
expect(response.feeds![0].title, 'test1'); |
|
|
|
expect(response.feeds[0].title, 'test1'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Move feed to folder', () async { |
|
|
|
test('Move feed to folder', () async { |
|
|
@ -70,20 +70,20 @@ Future main() async { |
|
|
|
|
|
|
|
|
|
|
|
final response = await client.news.listFolders(); |
|
|
|
final response = await client.news.listFolders(); |
|
|
|
expect(response.folders, hasLength(1)); |
|
|
|
expect(response.folders, hasLength(1)); |
|
|
|
expect(response.folders![0].id, 1); |
|
|
|
expect(response.folders[0].id, 1); |
|
|
|
expect(response.folders![0].name, 'test1'); |
|
|
|
expect(response.folders[0].name, 'test1'); |
|
|
|
expect(response.folders![0].opened, true); |
|
|
|
expect(response.folders[0].opened, true); |
|
|
|
expect(response.folders![0].feeds, hasLength(0)); |
|
|
|
expect(response.folders[0].feeds, hasLength(0)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Mark feed as read', () async { |
|
|
|
test('Mark feed as read', () async { |
|
|
|
final feedsResponse = await addWikipediaFeed(); |
|
|
|
final feedsResponse = await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
var articlesResponse = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
var articlesResponse = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
expect(articlesResponse.items!.length, greaterThan(0)); |
|
|
|
expect(articlesResponse.items.length, greaterThan(0)); |
|
|
|
|
|
|
|
|
|
|
|
await client.news.markFeedAsRead( |
|
|
|
await client.news.markFeedAsRead( |
|
|
|
feedId: feedsResponse.feeds![0].id!, |
|
|
|
feedId: feedsResponse.feeds[0].id, |
|
|
|
newestItemId: feedsResponse.newestItemId!, |
|
|
|
newestItemId: feedsResponse.newestItemId!, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -98,11 +98,11 @@ Future main() async { |
|
|
|
await addWikipediaFeed(); |
|
|
|
await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listArticles(); |
|
|
|
response = await client.news.listArticles(); |
|
|
|
expect(response.items!.length, greaterThan(0)); |
|
|
|
expect(response.items.length, greaterThan(0)); |
|
|
|
expect(response.items![0].body, isNotNull); |
|
|
|
expect(response.items[0].body, isNotNull); |
|
|
|
expect(response.items![0].feedId, 1); |
|
|
|
expect(response.items[0].feedId, 1); |
|
|
|
expect(response.items![0].unread, true); |
|
|
|
expect(response.items[0].unread, true); |
|
|
|
expect(response.items![0].starred, false); |
|
|
|
expect(response.items[0].starred, false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('List updated articles', () async { |
|
|
|
test('List updated articles', () async { |
|
|
@ -114,17 +114,17 @@ Future main() async { |
|
|
|
await addWikipediaFeed(); |
|
|
|
await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
var response = await client.news.listArticles(); |
|
|
|
var response = await client.news.listArticles(); |
|
|
|
final wikipediaArticles = response.items!.length; |
|
|
|
final wikipediaArticles = response.items.length; |
|
|
|
expect(wikipediaArticles, greaterThan(0)); |
|
|
|
expect(wikipediaArticles, greaterThan(0)); |
|
|
|
|
|
|
|
|
|
|
|
await addNasaFeed(); |
|
|
|
await addNasaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listArticles(); |
|
|
|
response = await client.news.listArticles(); |
|
|
|
final nasaArticles = response.items!.length - wikipediaArticles; |
|
|
|
final nasaArticles = response.items.length - wikipediaArticles; |
|
|
|
expect(nasaArticles, greaterThan(0)); |
|
|
|
expect(nasaArticles, greaterThan(0)); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listUpdatedArticles( |
|
|
|
response = await client.news.listUpdatedArticles( |
|
|
|
lastModified: response.items![response.items!.length - 1 - nasaArticles].lastModified!, |
|
|
|
lastModified: response.items[response.items.length - 1 - nasaArticles].lastModified, |
|
|
|
); |
|
|
|
); |
|
|
|
expect(response.items, hasLength(nasaArticles)); |
|
|
|
expect(response.items, hasLength(nasaArticles)); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -133,11 +133,11 @@ Future main() async { |
|
|
|
await addWikipediaFeed(); |
|
|
|
await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
var response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
var response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
final unreadArticles = response.items!.length; |
|
|
|
final unreadArticles = response.items.length; |
|
|
|
expect(unreadArticles, greaterThan(0)); |
|
|
|
expect(unreadArticles, greaterThan(0)); |
|
|
|
|
|
|
|
|
|
|
|
await client.news.markArticleAsRead( |
|
|
|
await client.news.markArticleAsRead( |
|
|
|
itemId: response.items![0].id!, |
|
|
|
itemId: response.items[0].id, |
|
|
|
); |
|
|
|
); |
|
|
|
response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
expect(response.items, hasLength(unreadArticles - 1)); |
|
|
|
expect(response.items, hasLength(unreadArticles - 1)); |
|
|
@ -147,13 +147,13 @@ Future main() async { |
|
|
|
await addWikipediaFeed(); |
|
|
|
await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
var response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
var response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
final readArticle = response.items![0]; |
|
|
|
final readArticle = response.items[0]; |
|
|
|
await client.news.markArticleAsRead(itemId: readArticle.id!); |
|
|
|
await client.news.markArticleAsRead(itemId: readArticle.id); |
|
|
|
response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
final unreadArticles = response.items!.length; |
|
|
|
final unreadArticles = response.items.length; |
|
|
|
expect(unreadArticles, greaterThan(0)); |
|
|
|
expect(unreadArticles, greaterThan(0)); |
|
|
|
|
|
|
|
|
|
|
|
await client.news.markArticleAsUnread(itemId: readArticle.id!); |
|
|
|
await client.news.markArticleAsUnread(itemId: readArticle.id); |
|
|
|
response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
response = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
expect(response.items, hasLength(unreadArticles + 1)); |
|
|
|
expect(response.items, hasLength(unreadArticles + 1)); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -162,12 +162,12 @@ Future main() async { |
|
|
|
await addWikipediaFeed(); |
|
|
|
await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
var response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
var response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
final starredArticles = response.items!.length; |
|
|
|
final starredArticles = response.items.length; |
|
|
|
expect(starredArticles, 0); |
|
|
|
expect(starredArticles, 0); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listArticles(); |
|
|
|
response = await client.news.listArticles(); |
|
|
|
await client.news.starArticle( |
|
|
|
await client.news.starArticle( |
|
|
|
itemId: response.items![0].id!, |
|
|
|
itemId: response.items[0].id, |
|
|
|
); |
|
|
|
); |
|
|
|
response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
expect(response.items, hasLength(1)); |
|
|
|
expect(response.items, hasLength(1)); |
|
|
@ -177,16 +177,16 @@ Future main() async { |
|
|
|
await addWikipediaFeed(); |
|
|
|
await addWikipediaFeed(); |
|
|
|
|
|
|
|
|
|
|
|
var response = await client.news.listArticles(); |
|
|
|
var response = await client.news.listArticles(); |
|
|
|
final item = response.items![0]; |
|
|
|
final item = response.items[0]; |
|
|
|
|
|
|
|
|
|
|
|
await client.news.starArticle( |
|
|
|
await client.news.starArticle( |
|
|
|
itemId: item.id!, |
|
|
|
itemId: item.id, |
|
|
|
); |
|
|
|
); |
|
|
|
response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
expect(response.items, hasLength(1)); |
|
|
|
expect(response.items, hasLength(1)); |
|
|
|
|
|
|
|
|
|
|
|
await client.news.unstarArticle( |
|
|
|
await client.news.unstarArticle( |
|
|
|
itemId: item.id!, |
|
|
|
itemId: item.id, |
|
|
|
); |
|
|
|
); |
|
|
|
response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
response = await client.news.listArticles(type: NewsListType.starred.code); |
|
|
|
expect(response.items, hasLength(0)); |
|
|
|
expect(response.items, hasLength(0)); |
|
|
@ -198,17 +198,17 @@ Future main() async { |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.createFolder(name: 'test1'); |
|
|
|
response = await client.news.createFolder(name: 'test1'); |
|
|
|
expect(response.folders, hasLength(1)); |
|
|
|
expect(response.folders, hasLength(1)); |
|
|
|
expect(response.folders![0].id, 1); |
|
|
|
expect(response.folders[0].id, 1); |
|
|
|
expect(response.folders![0].name, 'test1'); |
|
|
|
expect(response.folders[0].name, 'test1'); |
|
|
|
expect(response.folders![0].opened, true); |
|
|
|
expect(response.folders[0].opened, true); |
|
|
|
expect(response.folders![0].feeds, hasLength(0)); |
|
|
|
expect(response.folders[0].feeds, hasLength(0)); |
|
|
|
|
|
|
|
|
|
|
|
response = await client.news.listFolders(); |
|
|
|
response = await client.news.listFolders(); |
|
|
|
expect(response.folders, hasLength(1)); |
|
|
|
expect(response.folders, hasLength(1)); |
|
|
|
expect(response.folders![0].id, 1); |
|
|
|
expect(response.folders[0].id, 1); |
|
|
|
expect(response.folders![0].name, 'test1'); |
|
|
|
expect(response.folders[0].name, 'test1'); |
|
|
|
expect(response.folders![0].opened, true); |
|
|
|
expect(response.folders[0].opened, true); |
|
|
|
expect(response.folders![0].feeds, hasLength(0)); |
|
|
|
expect(response.folders[0].feeds, hasLength(0)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('List folders', () async { |
|
|
|
test('List folders', () async { |
|
|
@ -220,14 +220,14 @@ Future main() async { |
|
|
|
|
|
|
|
|
|
|
|
response = response = await client.news.listFolders(); |
|
|
|
response = response = await client.news.listFolders(); |
|
|
|
expect(response.folders, hasLength(2)); |
|
|
|
expect(response.folders, hasLength(2)); |
|
|
|
expect(response.folders![0].id, 1); |
|
|
|
expect(response.folders[0].id, 1); |
|
|
|
expect(response.folders![0].name, 'test1'); |
|
|
|
expect(response.folders[0].name, 'test1'); |
|
|
|
expect(response.folders![0].opened, true); |
|
|
|
expect(response.folders[0].opened, true); |
|
|
|
expect(response.folders![0].feeds, hasLength(0)); |
|
|
|
expect(response.folders[0].feeds, hasLength(0)); |
|
|
|
expect(response.folders![1].id, 2); |
|
|
|
expect(response.folders[1].id, 2); |
|
|
|
expect(response.folders![1].name, 'test2'); |
|
|
|
expect(response.folders[1].name, 'test2'); |
|
|
|
expect(response.folders![1].opened, true); |
|
|
|
expect(response.folders[1].opened, true); |
|
|
|
expect(response.folders![1].feeds, hasLength(0)); |
|
|
|
expect(response.folders[1].feeds, hasLength(0)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Add feed to folder', () async { |
|
|
|
test('Add feed to folder', () async { |
|
|
@ -236,8 +236,8 @@ Future main() async { |
|
|
|
expect(response.starredCount, null); |
|
|
|
expect(response.starredCount, null); |
|
|
|
expect(response.newestItemId, isNotNull); |
|
|
|
expect(response.newestItemId, isNotNull); |
|
|
|
expect(response.feeds, hasLength(1)); |
|
|
|
expect(response.feeds, hasLength(1)); |
|
|
|
expect(response.feeds![0].folderId, 1); |
|
|
|
expect(response.feeds[0].folderId, 1); |
|
|
|
expect(response.feeds![0].url, wikipediaFeedURL); |
|
|
|
expect(response.feeds[0].url, wikipediaFeedURL); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Mark folder as read', () async { |
|
|
|
test('Mark folder as read', () async { |
|
|
@ -245,10 +245,10 @@ Future main() async { |
|
|
|
final feedsResponse = await addWikipediaFeed(1); |
|
|
|
final feedsResponse = await addWikipediaFeed(1); |
|
|
|
|
|
|
|
|
|
|
|
var articlesResponse = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
var articlesResponse = await client.news.listArticles(type: NewsListType.unread.code); |
|
|
|
expect(articlesResponse.items!.length, greaterThan(0)); |
|
|
|
expect(articlesResponse.items.length, greaterThan(0)); |
|
|
|
|
|
|
|
|
|
|
|
await client.news.markFolderAsRead( |
|
|
|
await client.news.markFolderAsRead( |
|
|
|
folderId: foldersResponse.folders![0].id!, |
|
|
|
folderId: foldersResponse.folders[0].id, |
|
|
|
newestItemId: feedsResponse.newestItemId!, |
|
|
|
newestItemId: feedsResponse.newestItemId!, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|