Created
September 27, 2019 13:29
-
-
Save knaeckeKami/2f7c51f7ea67abf8a82786ee1c964fac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:built_collection/built_collection.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:neocortex_mobile/db/app_db/app_db.dart'; | |
import 'package:neocortex_mobile/feature/search/search_history_repository.dart'; | |
import 'package:test/test.dart' as test; | |
import 'util/integration_test_helpers.dart' as integration; | |
void main() { | |
integration.initIntegrationTests(); | |
SearchHistoryRepository repository = SearchHistoryRepository(AppDatabase()); | |
integration.setUp(() async{ | |
// ignore: invalid_use_of_visible_for_testing_member | |
await repository.delete(repository.searchHistory).go(); | |
}); | |
integration.test("is empty at beginning", () async { | |
integration.expect(await repository.getSearchHistory(), isEmpty); | |
}); | |
integration.test("can insert data", () async { | |
final testData = BuiltList<String>([ | |
"entry 1", | |
"abc", | |
"1234", | |
]); | |
for (final entry in testData) { | |
await repository.insertSearchEntry(entry); | |
} | |
final result = await repository.getSearchHistory(); | |
integration.expect(BuiltList<String>(result), equals(testData)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment