UNPKG

@commercetools-frontend/menu-cli

Version:

CLI to manage a Custom Application menu.json with translations support.

99 lines (95 loc) 2.49 kB
import path from 'path'; import buildCms from './build'; const cwd = process.cwd(); describe('with one locale (de)', () => { it('should generate a main aund sub menu with a specified locale', async () => { expect( await buildCms( { 'menu-file': 'fixtures/menu.mjs', 'out-file': '', 'i18n-folder': 'fixtures/i18n/data', locales: 'de', silent: true, }, { cwd: path.join(cwd, 'packages-scripts/menu-cli') } ) ).toMatchInlineSnapshot(` Object { "key": "test", "labelAllLocales": Array [ Object { "locale": "de", "value": "Testmenu", }, ], "permissions": "ViewOrders", "shouldRenderDivider": false, "submenu": Array [ Object { "key": "test-sub", "labelAllLocales": Array [ Object { "locale": "de", "value": "Testuntermenu", }, ], "permissions": Array [], "uriPath": "test/sub", }, ], "uriPath": "test", } `); }); }); describe('with two locales (de,fr)', () => { it('should generate a main aund sub menu with the locales', async () => { expect( await buildCms( { 'menu-file': 'fixtures/menu.mjs', 'out-file': '', 'i18n-folder': 'fixtures/i18n/data', locales: 'de,fr-FR', silent: true, }, { cwd: path.join(cwd, 'packages-scripts/menu-cli') } ) ).toMatchInlineSnapshot(` Object { "key": "test", "labelAllLocales": Array [ Object { "locale": "de", "value": "Testmenu", }, Object { "locale": "fr-FR", "value": "Menu de test", }, ], "permissions": "ViewOrders", "shouldRenderDivider": false, "submenu": Array [ Object { "key": "test-sub", "labelAllLocales": Array [ Object { "locale": "de", "value": "Testuntermenu", }, Object { "locale": "fr-FR", "value": "Sous-menu de test", }, ], "permissions": Array [], "uriPath": "test/sub", }, ], "uriPath": "test", } `); }); });