Skip to content

Instantly share code, notes, and snippets.

@blaugold
Last active December 28, 2021 12:32
Show Gist options
  • Save blaugold/90678d81d227d4e66e248080f4d00071 to your computer and use it in GitHub Desktop.
Save blaugold/90678d81d227d4e66e248080f4d00071 to your computer and use it in GitHub Desktop.
import 'dart:io';
import 'package:cbl/cbl.dart';
import 'package:cbl_dart/cbl_dart.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
// Each test file needs to initialize Couchbase Lite.
// It's a good idea to encapsulate that in a util function,
// that all tests use.
setUpAll(() async {
// If no `filesDir` is specified when initializing CouchbaseLiteDart,
// the working directory is used as the default database directory.
// By specifying a `filesDir` here, we can ensure that the tests don't
// create databases in the project directory.
final tempFilesDir = await Directory.systemTemp.createTemp();
// Now initialize Couchbase Lite.
await CouchbaseLiteDart.init(
edition: Edition.community,
filesDir: tempFilesDir.path,
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment