Skip to content

Commit

Permalink
test searchedArticles only when publisher has search support
Browse files Browse the repository at this point in the history
  • Loading branch information
ksh-b committed Jan 1, 2024
1 parent 551c3bf commit 485246a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/extractor/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ class ExtractorTest {
}

static Future<void> searchedArticlesTest(Publisher publisher, String query) async {
final searchArticles =
await publisher.searchedArticles(searchQuery: 'world', page: 1);
if (publisher.hasSearchSupport) {
final searchArticles =
await publisher.searchedArticles(searchQuery: query, page: 1);

expect(searchArticles, isNotEmpty);
expect(searchArticles, isNotEmpty);

var article = searchArticles.first;
expect(article, isA<NewsArticle>());
expect(article?.title, isNotEmpty);
expect(article?.publishedAt.value, isNot(0));
var article = searchArticles.first;
expect(article, isA<NewsArticle>());
expect(article?.title, isNotEmpty);
expect(article?.publishedAt.value, isNot(0));
}
}
}

0 comments on commit 485246a

Please sign in to comment.