connectionTests method

dynamic connectionTests()

Implementation

connectionTests() {
  group('SQLiteConnection', () {
    late Cursor cursor;

    setUp(() async {
      connection = await connector.connect(_initDb);
      cursor = await connection.cursor();
    });

    tearDown(() async {
      await connection.close();
    });

    group('close', () {
      test('makes other operations fail', () async {
        await connection.close();

        expect(connection.cursor, throwsA(isA<Error>()));
        expect(connection.commit, throwsA(isA<Error>()));
        expect(connection.rollback, throwsA(isA<Error>()));
      });

      test('makes cursors unavailable', () async {
        await connection.close();

        expect(
          () => cursor.execute(Query(from: schema)),
          throwsA(isA<Error>()),
        );
      });
    });
  });
}