@@ -16,36 +16,34 @@ import 'store_checks.dart';
1616
1717void main () {
1818 group ('non-migration tests' , () {
19- late AppDatabase database ;
19+ late AppDatabase db ;
2020
2121 setUp (() {
22- database = AppDatabase (NativeDatabase .memory ());
22+ db = AppDatabase (NativeDatabase .memory ());
2323 });
2424 tearDown (() async {
25- await database .close ();
25+ await db .close ();
2626 });
2727
2828 test ('initialize GlobalSettings with defaults' , () async {
29- check (await database .getGlobalSettings ()).themeSetting.isNull ();
29+ check (await db .getGlobalSettings ()).themeSetting.isNull ();
3030 });
3131
3232 test ('does not crash if multiple global settings rows' , () async {
33- await database .into (database .globalSettings)
33+ await db .into (db .globalSettings)
3434 .insert (const GlobalSettingsCompanion (themeSetting: Value (ThemeSetting .dark)));
3535
36- check (await database .select (database .globalSettings).get ()).length.equals (2 );
37- check (await database .getGlobalSettings ()).themeSetting.isNull ();
36+ check (await db .select (db .globalSettings).get ()).length.equals (2 );
37+ check (await db .getGlobalSettings ()).themeSetting.isNull ();
3838 });
3939
4040 test ('GlobalSettings updates work' , () async {
41- check (await database.getGlobalSettings ())
42- .themeSetting.isNull ();
41+ check (await db.getGlobalSettings ()).themeSetting.isNull ();
4342
4443 // As in doUpdateGlobalSettings.
45- await database .update (database .globalSettings)
44+ await db .update (db .globalSettings)
4645 .write (GlobalSettingsCompanion (themeSetting: Value (ThemeSetting .dark)));
47- check (await database.getGlobalSettings ())
48- .themeSetting.equals (ThemeSetting .dark);
46+ check (await db.getGlobalSettings ()).themeSetting.equals (ThemeSetting .dark);
4947 });
5048
5149 test ('create account' , () async {
@@ -58,8 +56,8 @@ void main() {
5856 zulipMergeBase: const Value ('6.0' ),
5957 zulipFeatureLevel: 42 ,
6058 );
61- final accountId = await database .createAccount (accountData);
62- final account = await (database .select (database .accounts)
59+ final accountId = await db .createAccount (accountData);
60+ final account = await (db .select (db .accounts)
6361 ..where ((a) => a.id.equals (accountId)))
6462 .watchSingle ()
6563 .first;
@@ -89,8 +87,8 @@ void main() {
8987 zulipMergeBase: const Value ('6.0' ),
9088 zulipFeatureLevel: 42 ,
9189 );
92- await database .createAccount (accountData);
93- await check (database .createAccount (accountDataWithSameUserId))
90+ await db .createAccount (accountData);
91+ await check (db .createAccount (accountDataWithSameUserId))
9492 .throws <AccountAlreadyExistsException >();
9593 });
9694
@@ -113,8 +111,8 @@ void main() {
113111 zulipMergeBase: const Value ('6.0' ),
114112 zulipFeatureLevel: 42 ,
115113 );
116- await database .createAccount (accountData);
117- await check (database .createAccount (accountDataWithSameEmail))
114+ await db .createAccount (accountData);
115+ await check (db .createAccount (accountDataWithSameEmail))
118116 .throws <AccountAlreadyExistsException >();
119117 });
120118 });
0 commit comments