@@ -83,13 +83,29 @@ describe("<DeferredLocationQuestion />", () => {
8383 expect ( screen . queryByTestId ( "city-success-banner" ) ) . not . toBeInTheDocument ( ) ;
8484 } ) ;
8585
86- it ( "shows inner content without question nor success banner when already location saved" , ( ) => {
86+ it ( "shows inner content with success banner when already location saved" , ( ) => {
8787 const municipality = generateMunicipality ( { } ) ;
8888 const business = generateBusiness ( { profileData : generateProfileData ( { municipality } ) } ) ;
8989 renderComponent ( { initialBusiness : business , innerContent : "inner-content" } ) ;
9090 expect ( screen . queryByText ( Config . deferredLocation . header ) ) . not . toBeInTheDocument ( ) ;
9191 expect ( screen . getByText ( "inner-content" ) ) . toBeInTheDocument ( ) ;
92+ expect ( screen . getByTestId ( "city-success-banner" ) ) . toBeInTheDocument ( ) ;
93+ } ) ;
94+
95+ it ( "shows question form when Remove City is clicked from saved location" , async ( ) => {
96+ const municipality = generateMunicipality ( { displayName : "Allendale" } ) ;
97+ const business = generateBusiness ( { profileData : generateProfileData ( { municipality } ) } ) ;
98+ renderComponent ( { initialBusiness : business , innerContent : "inner-content" } ) ;
99+
100+ expect ( screen . getByTestId ( "city-success-banner" ) ) . toBeInTheDocument ( ) ;
101+ expect ( screen . getByText ( "inner-content" ) ) . toBeInTheDocument ( ) ;
102+ expect ( screen . queryByText ( Config . deferredLocation . header ) ) . not . toBeInTheDocument ( ) ;
103+
104+ fireEvent . click ( screen . getByText ( Config . deferredLocation . removeText ) ) ;
105+
106+ expect ( screen . getByText ( Config . deferredLocation . header ) ) . toBeInTheDocument ( ) ;
92107 expect ( screen . queryByTestId ( "city-success-banner" ) ) . not . toBeInTheDocument ( ) ;
108+ expect ( screen . queryByText ( "inner-content" ) ) . not . toBeInTheDocument ( ) ;
93109 } ) ;
94110
95111 describe ( "when saving location" , ( ) => {
@@ -122,22 +138,6 @@ describe("<DeferredLocationQuestion />", () => {
122138 expect ( screen . getByText ( "inner-content" ) ) . toBeInTheDocument ( ) ;
123139 } ) ;
124140
125- it ( "shows location question when edit button is clicked" , async ( ) => {
126- await selectNewarkAndSave ( ) ;
127- fireEvent . click ( screen . getByText ( Config . deferredLocation . editText ) ) ;
128- expect ( screen . getByText ( Config . deferredLocation . header ) ) . toBeInTheDocument ( ) ;
129- expect ( screen . queryByTestId ( "city-success-banner" ) ) . not . toBeInTheDocument ( ) ;
130- } ) ;
131-
132- it ( "shows inner content when saving location after editing" , async ( ) => {
133- await selectNewarkAndSave ( ) ;
134- fireEvent . click ( screen . getByText ( Config . deferredLocation . editText ) ) ;
135- selectLocationByText ( "Absecon" ) ;
136- fireEvent . click ( screen . getByText ( Config . deferredLocation . deferredOnboardingSaveButtonText ) ) ;
137- await screen . findByTestId ( "city-success-banner" ) ;
138- expect ( screen . getByText ( "inner-content" ) ) . toBeInTheDocument ( ) ;
139- } ) ;
140-
141141 it ( "removes municipality from user profile when clicking remove button" , async ( ) => {
142142 await selectNewarkAndSave ( ) ;
143143 fireEvent . click ( screen . getByText ( Config . deferredLocation . removeText ) ) ;
0 commit comments