File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,28 @@ void main() {
2727 });
2828 }
2929
30+ test ('should not delete data on close' , () async {
31+ final db = await testUtils.setupDatabase (path: path);
32+ await createTables (db);
33+
34+ await db
35+ .execute ('INSERT INTO test_data(description) VALUES(?)' , ['test' ]);
36+
37+ final initialItems = await db.getAll ('SELECT * FROM test_data' );
38+ expect (initialItems.rows.length, greaterThan (0 ));
39+
40+ await db.close ();
41+
42+ final db2 = await testUtils.setupDatabase (path: path);
43+ // This could also be a get call with an exception
44+ final table2 = await db2.getAll (
45+ "SELECT name FROM sqlite_master WHERE type='table' AND name='test_data';" );
46+ expect (table2.rows.length, greaterThan (0 ),
47+ reason: "Table should be persisted from last connection" );
48+
49+ await db2.close ();
50+ });
51+
3052 test ('should not allow direct db calls within a transaction callback' ,
3153 () async {
3254 final db = await testUtils.setupDatabase (path: path);
You can’t perform that action at this time.
0 commit comments