File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " strapi-plugin-navigation" ,
3- "version" : " 3.3.5-beta.1 " ,
3+ "version" : " 3.3.5" ,
44 "description" : " Strapi - Navigation plugin" ,
55 "strapi" : {
66 "name" : " navigation" ,
Original file line number Diff line number Diff line change @@ -272,6 +272,24 @@ describe('Navigation', () => {
272272 ) ;
273273 expect ( mockRepository . remove ) . not . toHaveBeenCalled ( ) ;
274274 } ) ;
275+
276+ it ( 'should return early without removing when defaultLocale is not defined' , async ( ) => {
277+ // Given
278+ const otherLocale = 'fr' ;
279+ const documentId = faker . string . uuid ( ) ;
280+ const navigations = [ getMockNavigation ( { documentId, locale : otherLocale } ) ] ;
281+
282+ mockI18nService . getDefaultLocale . mockResolvedValue ( null ) ;
283+ mockRepository . find . mockResolvedValue ( navigations ) ;
284+
285+ // When
286+ await removeNavigationsWithoutDefaultLocale ( { strapi : mockStrapi } ) ;
287+
288+ // Then
289+ expect ( mockRepository . find ) . toHaveBeenCalled ( ) ;
290+ expect ( mockI18nService . getDefaultLocale ) . toHaveBeenCalled ( ) ;
291+ expect ( mockRepository . remove ) . not . toHaveBeenCalled ( ) ;
292+ } ) ;
275293 } ) ;
276294 } ) ;
277295} ) ;
You can’t perform that action at this time.
0 commit comments