chore: Move the drift_offline_first to legacy in favor of Serverpod implementation (#32)
This commit is contained in:
parent
027aec5ed0
commit
cbc472523b
1 changed files with 13575 additions and 284 deletions
47
legacy/drift_offline_sync/test/two_databases_test.dart
Normal file
47
legacy/drift_offline_sync/test/two_databases_test.dart
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
@Skip('Skipping two databases test until migrations are implemented.')
|
||||
library;
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'utils/migration.dart';
|
||||
|
||||
void main() {
|
||||
test('Two databases with different schema versions 1-2', () async {
|
||||
final executor = NativeDatabase.memory();
|
||||
final first = FirstDb(executor);
|
||||
final second = SecondDb(executor);
|
||||
|
||||
// Trigger the migration.
|
||||
await first.managers.todosTable.create(
|
||||
(t) => t.call(content: 'test'),
|
||||
);
|
||||
|
||||
expect(first.created, isTrue);
|
||||
expect(first.didUpgrade, isFalse);
|
||||
expect(first.onBeforeOpen, isTrue);
|
||||
|
||||
// Trigger the migration.
|
||||
await second.managers.users.create(
|
||||
(t) => t.call(name: 'John Doe', profilePicture: Uint8List(10)),
|
||||
);
|
||||
|
||||
expect(second.created, isTrue);
|
||||
expect(second.onBeforeOpen, isTrue);
|
||||
expect(second.didUpgrade, isTrue);
|
||||
});
|
||||
|
||||
test('Two databases with different schema versions 2-1', () async {
|
||||
final executor = NativeDatabase.memory();
|
||||
final second = SecondDb(executor);
|
||||
final first = FirstDb(executor);
|
||||
|
||||
// Trigger the migration.
|
||||
final _ = second.users.all();
|
||||
expect(second.didUpgrade, isFalse);
|
||||
|
||||
final _ = first.todosTable.all();
|
||||
expect(first.didUpgrade, isTrue);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue