File tree Expand file tree Collapse file tree
packages/fxa-settings/src/components/Settings/PageDeleteAccount Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,17 +8,40 @@ import { LocationProvider } from '@reach/router';
88import { Meta } from '@storybook/react' ;
99import { withLocalization } from 'fxa-react/lib/storybooks' ;
1010import SettingsLayout from '../SettingsLayout' ;
11+ import { Account , AppContext } from '../../../models' ;
12+ import { mockAppContext , MOCK_ACCOUNT } from '../../../models/mocks' ;
1113
1214export default {
1315 title : 'Pages/Settings/DeleteAccount' ,
1416 component : PageDeleteAccount ,
1517 decorators : [ withLocalization ] ,
1618} as Meta ;
1719
18- export const Default = ( ) => (
19- < LocationProvider >
20- < SettingsLayout >
21- < PageDeleteAccount />
22- </ SettingsLayout >
23- </ LocationProvider >
24- ) ;
20+ const accountWithPassword = {
21+ ...MOCK_ACCOUNT ,
22+ hasPassword : true ,
23+ destroy : ( ) => Promise . resolve ( ) ,
24+ } as unknown as Account ;
25+
26+ const accountWithoutPassword = {
27+ ...MOCK_ACCOUNT ,
28+ hasPassword : false ,
29+ destroy : ( ) => Promise . resolve ( ) ,
30+ } as unknown as Account ;
31+
32+ const storyWithContext = ( account : Account ) => {
33+ const story = ( ) => (
34+ < LocationProvider >
35+ < AppContext . Provider value = { mockAppContext ( { account } ) } >
36+ < SettingsLayout >
37+ < PageDeleteAccount />
38+ </ SettingsLayout >
39+ </ AppContext . Provider >
40+ </ LocationProvider >
41+ ) ;
42+ return story ;
43+ } ;
44+
45+ export const Default = storyWithContext ( accountWithPassword ) ;
46+
47+ export const WithoutPassword = storyWithContext ( accountWithoutPassword ) ;
You can’t perform that action at this time.
0 commit comments