mirror of https://github.com/AMT-Cheif/drift.git
Update integration tests for drift_sqflite
This commit is contained in:
parent
657ee5133f
commit
cedf3a3370
|
@ -26,6 +26,7 @@ apply plugin: 'kotlin-android'
|
|||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
namespace 'com.example.drift_sqflite'
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
classpath 'com.android.tools.build:gradle:8.0.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,6 @@ subprojects {
|
|||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:sqflite/sqflite.dart' show getDatabasesPath;
|
||||
import 'package:sqflite/sqflite.dart' show DatabaseException, getDatabasesPath;
|
||||
|
||||
class SqfliteExecutor extends TestExecutor {
|
||||
@override
|
||||
|
@ -99,11 +99,19 @@ Future<void> main() async {
|
|||
await database.customStatement('CREATE TABLE y (foo INTEGER PRIMARY KEY '
|
||||
'REFERENCES x (foo) DEFERRABLE INITIALLY DEFERRED);');
|
||||
|
||||
// On Android, the failing commit of the transaction rolls it back implicitly,
|
||||
// causing the drift's rollback recovery to fail. This is expected and not
|
||||
// harmful since the end result (transaction not applied) is the same. On
|
||||
// iOS, the transaction stays active despite the failing commit.
|
||||
final expectedException = Platform.isAndroid
|
||||
? isA<CouldNotRollBackException>()
|
||||
: isA<DatabaseException>();
|
||||
|
||||
await expectLater(
|
||||
database.transaction(() async {
|
||||
await database.customStatement('INSERT INTO y VALUES (2);');
|
||||
}),
|
||||
throwsA(isA<CouldNotRollBackException>()),
|
||||
throwsA(expectedException),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue