Skip to content

Instantly share code, notes, and snippets.

@knaeckeKami
Created September 27, 2019 13:29
Show Gist options
  • Save knaeckeKami/2f7c51f7ea67abf8a82786ee1c964fac to your computer and use it in GitHub Desktop.
Save knaeckeKami/2f7c51f7ea67abf8a82786ee1c964fac to your computer and use it in GitHub Desktop.
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