@@ -354,7 +354,7 @@ void main() {
354
354
355
355
// TODO test database gets updated correctly (an integration test with sqlite?)
356
356
});
357
-
357
+
358
358
test ('GlobalStore.updateZulipVersionData' , () async {
359
359
final [currentZulipVersion, newZulipVersion ]
360
360
= ['10.0-beta2-302-gf5b08b11f4' , '10.0-beta2-351-g75ac8fe961' ];
@@ -380,6 +380,20 @@ void main() {
380
380
zulipFeatureLevel: newZulipFeatureLevel));
381
381
});
382
382
383
+ test ('GlobalStore.updateRealmData' , () async {
384
+ final selfAccount = eg.selfAccount.copyWith (
385
+ realmName: Value ('Organization A' ),
386
+ realmIcon: Value (Uri .parse ('/image-a.png' )));
387
+ final globalStore = eg.globalStore (accounts: [selfAccount]);
388
+ final updated = await globalStore.updateRealmData (selfAccount.id,
389
+ realmName: 'Organization B' ,
390
+ realmIcon: Uri .parse ('/image-b.png' ));
391
+ check (globalStore.getAccount (selfAccount.id)).identicalTo (updated);
392
+ check (updated).equals (selfAccount.copyWith (
393
+ realmName: Value ('Organization B' ),
394
+ realmIcon: Value (Uri .parse ('/image-b.png' ))));
395
+ });
396
+
383
397
group ('GlobalStore.removeAccount' , () {
384
398
void checkGlobalStore (GlobalStore store, int accountId, {
385
399
required bool expectAccount,
@@ -515,18 +529,24 @@ void main() {
515
529
516
530
test ('updates account from snapshot' , () => awaitFakeAsync ((async ) async {
517
531
final account = eg.account (user: eg.selfUser,
532
+ realmName: 'Organization A' ,
533
+ realmIcon: Uri .parse ('/image-a.png' ),
518
534
zulipVersion: '6.0+gabcd' ,
519
535
zulipMergeBase: '6.0' ,
520
536
zulipFeatureLevel: 123 ,
521
537
);
522
538
await prepareStore (account: account);
523
539
check (globalStore.getAccount (account.id)).isNotNull ()
540
+ ..realmName.equals ('Organization A' )
541
+ ..realmIcon.equals (Uri .parse ('/image-a.png' ))
524
542
..zulipVersion.equals ('6.0+gabcd' )
525
543
..zulipMergeBase.equals ('6.0' )
526
544
..zulipFeatureLevel.equals (123 );
527
545
528
546
globalStore.useCachedApiConnections = true ;
529
547
connection.prepare (json: eg.initialSnapshot (
548
+ realmName: 'Organization B' ,
549
+ realmIconUrl: Uri .parse ('/image-b.png' ),
530
550
zulipVersion: '8.0+g9876' ,
531
551
zulipMergeBase: '8.0' ,
532
552
zulipFeatureLevel: 234 ,
@@ -535,6 +555,8 @@ void main() {
535
555
updateMachine.debugPauseLoop ();
536
556
check (globalStore.getAccount (account.id)).isNotNull ()
537
557
..identicalTo (updateMachine.store.account)
558
+ ..realmName.equals ('Organization B' )
559
+ ..realmIcon.equals (Uri .parse ('/image-b.png' ))
538
560
..zulipVersion.equals ('8.0+g9876' )
539
561
..zulipMergeBase.equals ('8.0' )
540
562
..zulipFeatureLevel.equals (234 );
0 commit comments