@@ -9,6 +9,7 @@ import PageSettings from '.';
99import {
1010 MOCK_ACCOUNT ,
1111 mockAppContext ,
12+ mockSettingsContext ,
1213 renderWithRouter ,
1314} from '../../../models/mocks' ;
1415import * as Metrics from '../../../lib/metrics' ;
@@ -19,6 +20,10 @@ import {
1920 ALL_PRODUCT_PROMO_SUBSCRIPTIONS ,
2021} from '../../../pages/mocks' ;
2122import { MOCK_SERVICES } from '../ConnectedServices/mocks' ;
23+ import { mockWebIntegration } from '../../../pages/Signin/SigninRecoveryCode/mocks' ;
24+ import { SettingsContext } from '../../../models/contexts/SettingsContext' ;
25+
26+ jest . mock ( '../../../models/AlertBarInfo' ) ;
2227
2328jest . mock ( '../../../lib/metrics' , ( ) => ( {
2429 setProperties : jest . fn ( ) ,
@@ -35,6 +40,9 @@ jest.mock('../../../lib/glean', () => ({
3540 deleteAccount : {
3641 settingsSubmit : jest . fn ( ) ,
3742 } ,
43+ accountBanner : {
44+ reactivationSuccessView : jest . fn ( ) ,
45+ } ,
3846 } ,
3947} ) ) ;
4048
@@ -68,6 +76,25 @@ describe('PageSettings', () => {
6876 } ) ;
6977 } ) ;
7078
79+ it ( 'renders without imploding when passing an integration' , async ( ) => {
80+ renderWithRouter ( < PageSettings integration = { mockWebIntegration } /> ) ;
81+
82+ // assert all typical PageSetting elements
83+ expect ( screen . getByTestId ( 'settings-profile' ) ) . toBeInTheDocument ( ) ;
84+ expect ( screen . getByTestId ( 'settings-security' ) ) . toBeInTheDocument ( ) ;
85+ expect (
86+ screen . getByTestId ( 'settings-connected-services' )
87+ ) . toBeInTheDocument ( ) ;
88+ expect ( screen . getByTestId ( 'settings-delete-account' ) ) . toBeInTheDocument ( ) ;
89+ expect (
90+ screen . queryByTestId ( 'settings-data-collection' )
91+ ) . toBeInTheDocument ( ) ;
92+ expect ( Metrics . setProperties ) . toHaveBeenCalledWith ( {
93+ lang : null ,
94+ uid : 'abc123' ,
95+ } ) ;
96+ } ) ;
97+
7198 describe ( 'glean metrics' , ( ) => {
7299 it ( 'emits the expected event on render' , async ( ) => {
73100 renderWithRouter ( < PageSettings /> ) ;
@@ -118,5 +145,32 @@ describe('PageSettings', () => {
118145 expect ( GleanMetrics . accountPref . promoMonitorView ) . not . toBeCalled ( ) ;
119146 } ) ;
120147 } ) ;
148+ describe ( 'inactive account verified' , ( ) => {
149+ const alertBarInfo = {
150+ success : jest . fn ( ) ,
151+ } as any ;
152+ const settingsContext = mockSettingsContext ( { alertBarInfo } ) ;
153+
154+ it ( 'user has seen the reactivation banner' , async ( ) => {
155+ mockWebIntegration . data . utmCampaign =
156+ 'fx-account-inactive-reminder-third' ;
157+ mockWebIntegration . data . utmMedium = 'email' ;
158+ mockWebIntegration . data . utmContent = 'fx-account-deletion' ;
159+ renderWithRouter (
160+ < AppContext . Provider value = { mockAppContext ( ) } >
161+ < SettingsContext . Provider value = { settingsContext } >
162+ < PageSettings integration = { mockWebIntegration } />
163+ </ SettingsContext . Provider >
164+ </ AppContext . Provider >
165+ ) ;
166+
167+ expect ( alertBarInfo . success ) . toHaveBeenCalledWith (
168+ 'Signed in successfully. Your Mozilla account and data will stay active.'
169+ ) ;
170+ expect (
171+ GleanMetrics . accountBanner . reactivationSuccessView
172+ ) . toBeCalledTimes ( 1 ) ;
173+ } ) ;
174+ } ) ;
121175 } ) ;
122176} ) ;
0 commit comments