11import 'dart:async' ;
22
33import 'package:checks/checks.dart' ;
4- import 'package:drift/drift.dart' ;
54import 'package:flutter/material.dart' ;
65import 'package:flutter/services.dart' ;
76import 'package:flutter_test/flutter_test.dart' ;
@@ -11,8 +10,8 @@ import 'package:zulip/api/model/web_auth.dart';
1110import 'package:zulip/api/route/account.dart' ;
1211import 'package:zulip/api/route/realm.dart' ;
1312import 'package:zulip/model/binding.dart' ;
14- import 'package:zulip/model/database.dart' ;
1513import 'package:zulip/model/localizations.dart' ;
14+ import 'package:zulip/model/store.dart' ;
1615import 'package:zulip/widgets/app.dart' ;
1716import 'package:zulip/widgets/home.dart' ;
1817import 'package:zulip/widgets/login.dart' ;
@@ -249,7 +248,10 @@ void main() {
249248 }
250249
251250 testWidgets ('basic happy case' , (tester) async {
252- final serverSettings = eg.serverSettings ();
251+ final serverSettings = eg.serverSettings (
252+ realmName: 'Some organization' ,
253+ realmIcon: Uri .parse ('/some-image.png' ),
254+ );
253255 await prepare (tester, serverSettings);
254256 takeStartingRoutes ();
255257 check (pushedRoutes).isEmpty ();
@@ -259,10 +261,8 @@ void main() {
259261 check (testBinding.globalStore.accounts).single
260262 .equals (eg.selfAccount.copyWith (
261263 id: testBinding.globalStore.accounts.single.id,
262- // TODO store value from server settings during login flow
263- realmName: Value (null ),
264- // TODO store value from server settings during login flow
265- realmIcon: Value (null )));
264+ realmName: Value ('Some organization' ),
265+ realmIcon: Value (Uri .parse ('/some-image.png' ))));
266266 });
267267
268268 testWidgets ('logging into a second account' , (tester) async {
@@ -279,12 +279,7 @@ void main() {
279279 await login (tester, eg.otherAccount);
280280 final newAccount = testBinding.globalStore.accounts.singleWhere (
281281 (account) => account != eg.selfAccount);
282- check (newAccount).equals (eg.otherAccount.copyWith (
283- id: newAccount.id,
284- // TODO store value from server settings during login flow
285- realmName: Value (null ),
286- // TODO store value from server settings during login flow
287- realmIcon: Value (null )));
282+ check (newAccount).equals (eg.otherAccount.copyWith (id: newAccount.id));
288283 check (poppedRoutes).length.equals (2 );
289284 check (pushedRoutes).single.isA <WidgetRoute >().page.isA <HomePage >();
290285 });
@@ -309,11 +304,7 @@ void main() {
309304 await tester.idle ();
310305 check (testBinding.globalStore.accounts).single
311306 .equals (eg.selfAccount.copyWith (
312- id: testBinding.globalStore.accounts.single.id,
313- // TODO store value from server settings during login flow
314- realmName: Value (null ),
315- // TODO store value from server settings during login flow
316- realmIcon: Value (null )));
307+ id: testBinding.globalStore.accounts.single.id));
317308 });
318309
319310 testWidgets ('account already exists' , (tester) async {
@@ -356,6 +347,8 @@ void main() {
356347 signupUrl: '/accounts/register/social/google' ,
357348 );
358349 final serverSettings = eg.serverSettings (
350+ realmName: 'Some organization' ,
351+ realmIcon: Uri .parse ('/some-image.png' ),
359352 externalAuthenticationMethods: [method]);
360353 prepareBoringImageHttpClient (); // icon on social-auth button
361354 await prepare (tester, serverSettings);
@@ -392,10 +385,8 @@ void main() {
392385 final account = testBinding.globalStore.accounts.single;
393386 check (account).equals (eg.selfAccount.copyWith (
394387 id: account.id,
395- // TODO store value from server settings during login flow
396- realmName: Value (null ),
397- // TODO store value from server settings during login flow
398- realmIcon: Value (null )));
388+ realmName: Value ('Some organization' ),
389+ realmIcon: Value (Uri .parse ('/some-image.png' ))));
399390 check (pushedRoutes).single.isA <MaterialAccountWidgetRoute >()
400391 ..accountId.equals (account.id)
401392 ..page.isA <HomePage >();
0 commit comments