Skip to content

Commit

Permalink
accountsReducer tests: Test realm_push_notifications_enabled in /regi…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
chrisbobbe committed Jan 23, 2024
1 parent 11b32cb commit c63ed60
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/account/__tests__/accountsReducer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ describe('accountsReducer', () => {
),
).toEqual([{ ...account1, zulipFeatureLevel: newZulipFeatureLevel }, account2, account3]);
});

test('when realm_push_notifications_enabled: true, clears lastDismissedServerPushSetupNotice', () => {
const account = { ...eg.selfAccount, lastDismissedServerPushSetupNotice: new Date() };
const actualState = accountsReducer(
[account],
eg.mkActionRegisterComplete({ realm_push_notifications_enabled: true }),
);
expect(actualState).toEqual([{ ...account, lastDismissedServerPushSetupNotice: null }]);
});

test('when realm_push_notifications_enabled: false, preserves lastDismissedServerPushSetupNotice', () => {
const account = { ...eg.selfAccount, lastDismissedServerPushSetupNotice: new Date() };
const actualState = accountsReducer(
[account],
eg.mkActionRegisterComplete({ realm_push_notifications_enabled: false }),
);
expect(actualState).toEqual([account]);
});
});

describe('ACCOUNT_SWITCH', () => {
Expand Down

0 comments on commit c63ed60

Please sign in to comment.