Fix tests

This commit is contained in:
westito 2022-05-12 21:30:37 +02:00
parent f379ca0b25
commit 6c439a3a0f
4 changed files with 6 additions and 2 deletions

View File

@ -63,8 +63,6 @@ void main() {
final second = db.select(db.users).watch();
expect(second, emits(isEmpty));
// calling executor.dialect is ok, it's needed to construct the statement
verify(executor.dialect);
verifyNoMoreInteractions(executor);
});

View File

@ -1,3 +1,4 @@
@TestOn('vm')
import 'package:async/async.dart';
import 'package:drift/drift.dart';
import 'package:drift/remote.dart';

View File

@ -9,6 +9,7 @@ class MockExecutor extends Mock implements QueryExecutor {
MockExecutor([this.openingDetails]) {
when(dialect).thenReturn(SqlDialect.sqlite);
when(supportsBigInt).thenReturn(true);
when(runSelect(any, any)).thenAnswer((_) {
assert(_opened);
return Future.value([]);
@ -55,6 +56,9 @@ class MockExecutor extends Mock implements QueryExecutor {
SqlDialect get dialect =>
_nsm(Invocation.getter(#dialect), SqlDialect.sqlite);
@override
bool get supportsBigInt => _nsm(Invocation.getter(#supportsBigInt), true);
@override
Future<bool> ensureOpen(QueryExecutorUser? user) =>
_nsm(Invocation.method(#ensureOpen, [user]), Future.value(true));

View File

@ -7,6 +7,7 @@ dart format -o none --set-exit-if-changed .
dart analyze --fatal-infos --fatal-warnings
dart run build_runner build --delete-conflicting-outputs
dart test
dart test -p chrome
cd ../drift_dev
rm -rf .dart_tool