Skip to content

Commit 0e4e67e

Browse files
gnpricechrisbobbe
authored andcommitted
test [nfc]: Make all account IDs positive
Our account IDs are always positive integers, because they're generated by inserting into an AUTOINCREMENT column in our SQLite database: https://www.sqlite.org/autoinc.html So avoiding zero here helps keep the data realistic.
1 parent bf27e23 commit 0e4e67e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

test/example_data.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Account account({
119119
String? zulipMergeBase,
120120
String? ackedPushToken,
121121
}) {
122+
_checkPositive(id, 'account ID');
122123
return Account(
123124
id: id ?? 1000, // TODO generate example IDs
124125
realmUrl: realmUrl ?? _realmUrl,

test/widgets/app_test.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ void main() {
7474
}
7575

7676
List<Account> generateAccounts(int count) {
77-
return List.generate(count, (i) => eg.account(
78-
id: i,
79-
user: eg.user(fullName: 'User $i', email: 'user$i@example'),
80-
apiKey: 'user${i}apikey',
81-
));
77+
return List.generate(count, (i) {
78+
final id = i+1;
79+
return eg.account(
80+
id: id,
81+
user: eg.user(fullName: 'User $id', email: 'user$id@example'),
82+
apiKey: 'user${id}apikey',
83+
);
84+
});
8285
}
8386

8487
Finder findAccount(Account account) => find.text(account.email).hitTestable();

0 commit comments

Comments
 (0)