Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import 'package:built_collection/built_collection.dart';
  2. import 'package:flutter_test/flutter_test.dart';
  3. import 'package:neocortex_mobile/db/app_db/app_db.dart';
  4. import 'package:neocortex_mobile/feature/search/search_history_repository.dart';
  5. import 'package:test/test.dart' as test;
  6.  
  7. import 'util/integration_test_helpers.dart' as integration;
  8.  
  9. void main() {
  10. integration.initIntegrationTests();
  11.  
  12. SearchHistoryRepository repository = SearchHistoryRepository(AppDatabase());
  13.  
  14. integration.setUp(() async{
  15. // ignore: invalid_use_of_visible_for_testing_member
  16. await repository.delete(repository.searchHistory).go();
  17. });
  18.  
  19. integration.test("is empty at beginning", () async {
  20. integration.expect(await repository.getSearchHistory(), isEmpty);
  21. });
  22.  
  23. integration.test("can insert data", () async {
  24. final testData = BuiltList<String>([
  25. "entry 1",
  26. "abc",
  27. "1234",
  28. ]);
  29.  
  30. for (final entry in testData) {
  31. await repository.insertSearchEntry(entry);
  32. }
  33.  
  34. final result = await repository.getSearchHistory();
  35.  
  36. integration.expect(BuiltList<String>(result), equals(testData));
  37. });
  38.  
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement