Skip to content

Commit

Permalink
test: exp web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Jul 30, 2023
1 parent 7a0844e commit a87f4b0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages_web/sqflite_common_ffi_web_test/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ build/
/web/sqlite3.wasm
/test/sqflite_sw.js
/test/sqlite3.wasm
/test/sqflite_sw_v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import 'package:sqflite_common_test/all_test.dart' as all;
import 'package:sqflite_common_test/sqflite_test.dart';
import 'package:test/test.dart';

var _factory = databaseFactoryFfiWeb;
var _factory = createDatabaseFactoryFfiWeb(
options:
SqfliteFfiWebOptions(sharedWorkerUri: Uri.parse('sqflite_sw_v1.js')));

class SqfliteFfiWebTestContext extends SqfliteLocalTestContext {
SqfliteFfiWebTestContext() : super(databaseFactory: _factory);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:sqflite_common_ffi_web/src/setup/setup.dart';

Future<void> main() async {
await setupBinaries(options: SetupOptions(verbose: true, dir: 'test'));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:sqflite_common_ffi_web/src/setup/setup.dart';

Future<void> main() async {
await setupBinaries(
options: SetupOptions(verbose: true, dir: 'test', force: true));
}
25 changes: 14 additions & 11 deletions sqflite_common_test/lib/sqflite_protocol_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,20 @@ void run(SqfliteTestContext? context) {
await scenario.factory.databaseExists(inMemoryDatabasePath);
scenario.end();
});
test('delete', () async {
final scenario = wrapStartScenario(factory, [
[
'deleteDatabase',
{'path': ':memory:'},
null
]
]);
await scenario.factory.deleteDatabase(inMemoryDatabasePath);
scenario.end();
});
test(
'delete',
() async {
final scenario = wrapStartScenario(factory, [
[
'deleteDatabase',
{'path': ':memory:'},
null
]
]);
await scenario.factory.deleteDatabase(inMemoryDatabasePath);
scenario.end();
},
);
test('execute', () async {
final scenario = wrapStartScenario(factory, [
protocolOpenStep,
Expand Down

0 comments on commit a87f4b0

Please sign in to comment.