From c63ed600ac4a53a402183479627c17d390e299ba Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Thu, 18 Jan 2024 14:44:20 -0800 Subject: [PATCH] accountsReducer tests: Test realm_push_notifications_enabled in /register --- src/account/__tests__/accountsReducer-test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/account/__tests__/accountsReducer-test.js b/src/account/__tests__/accountsReducer-test.js index a679cf4a287..782b0040edb 100644 --- a/src/account/__tests__/accountsReducer-test.js +++ b/src/account/__tests__/accountsReducer-test.js @@ -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', () => {