Skip to content

Commit bb78140

Browse files
feat: add missing coverage
1 parent d24d4d0 commit bb78140

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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",

server/tests/utils/migration.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)