@@ -16,36 +16,34 @@ import 'store_checks.dart';
16
16
17
17
void main () {
18
18
group ('non-migration tests' , () {
19
- late AppDatabase database ;
19
+ late AppDatabase db ;
20
20
21
21
setUp (() {
22
- database = AppDatabase (NativeDatabase .memory ());
22
+ db = AppDatabase (NativeDatabase .memory ());
23
23
});
24
24
tearDown (() async {
25
- await database .close ();
25
+ await db .close ();
26
26
});
27
27
28
28
test ('initialize GlobalSettings with defaults' , () async {
29
- check (await database .getGlobalSettings ()).themeSetting.isNull ();
29
+ check (await db .getGlobalSettings ()).themeSetting.isNull ();
30
30
});
31
31
32
32
test ('does not crash if multiple global settings rows' , () async {
33
- await database .into (database .globalSettings)
33
+ await db .into (db .globalSettings)
34
34
.insert (const GlobalSettingsCompanion (themeSetting: Value (ThemeSetting .dark)));
35
35
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 ();
38
38
});
39
39
40
40
test ('GlobalSettings updates work' , () async {
41
- check (await database.getGlobalSettings ())
42
- .themeSetting.isNull ();
41
+ check (await db.getGlobalSettings ()).themeSetting.isNull ();
43
42
44
43
// As in doUpdateGlobalSettings.
45
- await database .update (database .globalSettings)
44
+ await db .update (db .globalSettings)
46
45
.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);
49
47
});
50
48
51
49
test ('create account' , () async {
@@ -58,8 +56,8 @@ void main() {
58
56
zulipMergeBase: const Value ('6.0' ),
59
57
zulipFeatureLevel: 42 ,
60
58
);
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)
63
61
..where ((a) => a.id.equals (accountId)))
64
62
.watchSingle ()
65
63
.first;
@@ -89,8 +87,8 @@ void main() {
89
87
zulipMergeBase: const Value ('6.0' ),
90
88
zulipFeatureLevel: 42 ,
91
89
);
92
- await database .createAccount (accountData);
93
- await check (database .createAccount (accountDataWithSameUserId))
90
+ await db .createAccount (accountData);
91
+ await check (db .createAccount (accountDataWithSameUserId))
94
92
.throws <AccountAlreadyExistsException >();
95
93
});
96
94
@@ -113,8 +111,8 @@ void main() {
113
111
zulipMergeBase: const Value ('6.0' ),
114
112
zulipFeatureLevel: 42 ,
115
113
);
116
- await database .createAccount (accountData);
117
- await check (database .createAccount (accountDataWithSameEmail))
114
+ await db .createAccount (accountData);
115
+ await check (db .createAccount (accountDataWithSameEmail))
118
116
.throws <AccountAlreadyExistsException >();
119
117
});
120
118
});
0 commit comments