Skip to content

Commit

Permalink
Merge pull request #2493 from nextcloud/fix/account_repository/login-…
Browse files Browse the repository at this point in the history
…active-account
  • Loading branch information
provokateurin authored Sep 14, 2024
2 parents cd697a1 + 31aaa4d commit 8402458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class AccountRepository {
Future<void> logIn(Account account) async {
final value = _accounts.value;

final active = value.active ?? account.credentials.id;
final active = account.credentials.id;
final accounts = value.accounts.rebuild((b) {
b[account.credentials.id] = account;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,19 @@ void main() {
credentials: credentialsList.first,
);

test('adds account and sets active if null', () async {
test('adds account and sets active', () async {
await repository.logIn(account);

await expectLater(
repository.accounts,
emits(
isA<_AccountStream>()
.having((e) => e.accounts, 'accounts', equals([accountsList.first]))
.having((e) => e.active, 'active', equals(accountsList.first)),
.having((e) => e.accounts, 'accounts', equals([account]))
.having((e) => e.active, 'active', equals(account)),
),
);
verify(() => storage.saveCredentials(any(that: contains(credentialsList.first)))).called(1);
verify(() => storage.saveLastAccount(credentialsList.first.id)).called(1);
verify(() => storage.saveCredentials(any(that: contains(account.credentials)))).called(1);
verify(() => storage.saveLastAccount(account.id)).called(1);
});
});

Expand Down

0 comments on commit 8402458

Please sign in to comment.