diff --git a/packages/core/strapi/lib/commands/__tests__/export.test.js b/packages/core/strapi/lib/commands/__tests__/export.test.js index 34775ac79f..e0cace9683 100644 --- a/packages/core/strapi/lib/commands/__tests__/export.test.js +++ b/packages/core/strapi/lib/commands/__tests__/export.test.js @@ -90,7 +90,7 @@ describe('Export', () => { jest.spyOn(console, 'error').mockImplementation(() => {}); // Now that everything is mocked, load the 'export' command - const exportCommand = require('../actions/export/action'); + const exportAction = require('../actions/export/action'); beforeEach(() => { jest.clearAllMocks(); @@ -100,7 +100,7 @@ describe('Export', () => { const filename = 'test'; await expectExit(0, async () => { - await exportCommand({ file: filename }); + await exportAction({ file: filename }); }); expect(console.error).not.toHaveBeenCalled(); @@ -114,7 +114,7 @@ describe('Export', () => { it('uses default path if not provided by user', async () => { await expectExit(0, async () => { - await exportCommand({}); + await exportAction({}); }); expect(mockUtils.getDefaultExportName).toHaveBeenCalledTimes(1); @@ -128,7 +128,7 @@ describe('Export', () => { it('encrypts the output file if specified', async () => { const encrypt = true; await expectExit(0, async () => { - await exportCommand({ encrypt }); + await exportAction({ encrypt }); }); expect(mockDataTransfer.file.providers.createLocalFileDestinationProvider).toHaveBeenCalledWith( @@ -142,7 +142,7 @@ describe('Export', () => { const key = 'secret-key'; const encrypt = true; await expectExit(0, async () => { - await exportCommand({ encrypt, key }); + await exportAction({ encrypt, key }); }); expect(mockDataTransfer.file.providers.createLocalFileDestinationProvider).toHaveBeenCalledWith( @@ -154,7 +154,7 @@ describe('Export', () => { it('uses compress option', async () => { await expectExit(0, async () => { - await exportCommand({ compress: false }); + await exportAction({ compress: false }); }); expect(mockDataTransfer.file.providers.createLocalFileDestinationProvider).toHaveBeenCalledWith( @@ -163,7 +163,7 @@ describe('Export', () => { }) ); await expectExit(0, async () => { - await exportCommand({ compress: true }); + await exportAction({ compress: true }); }); expect(mockDataTransfer.file.providers.createLocalFileDestinationProvider).toHaveBeenCalledWith( expect.objectContaining({ diff --git a/packages/core/strapi/lib/commands/__tests__/import.test.js b/packages/core/strapi/lib/commands/__tests__/import.test.js index 24d16a3962..6cce95dc49 100644 --- a/packages/core/strapi/lib/commands/__tests__/import.test.js +++ b/packages/core/strapi/lib/commands/__tests__/import.test.js @@ -96,7 +96,7 @@ describe('Import', () => { jest.spyOn(console, 'error').mockImplementation(() => {}); // Now that everything is mocked, load the 'import' command - const importCommand = require('../actions/import/action'); + const importAction = require('../actions/import/action'); beforeEach(() => { jest.clearAllMocks(); @@ -112,7 +112,7 @@ describe('Import', () => { }; await expectExit(0, async () => { - await importCommand(options); + await importAction(options); }); // strapi options diff --git a/packages/core/strapi/lib/commands/__tests__/transfer.test.js b/packages/core/strapi/lib/commands/__tests__/transfer.test.js index 8b9ee08251..9bf5f69b1d 100644 --- a/packages/core/strapi/lib/commands/__tests__/transfer.test.js +++ b/packages/core/strapi/lib/commands/__tests__/transfer.test.js @@ -72,7 +72,7 @@ describe('Transfer', () => { jest.mock('@strapi/data-transfer', () => mockDataTransfer); - const transferCommand = require('../actions/transfer/action'); + const transferAction = require('../actions/transfer/action'); // console spies jest.spyOn(console, 'log').mockImplementation(() => {}); @@ -91,7 +91,7 @@ describe('Transfer', () => { it('exits with error when no --to or --from is provided', async () => { await expectExit(1, async () => { - await transferCommand({ from: undefined, to: undefined }); + await transferAction({ from: undefined, to: undefined }); }); expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/one source/i)); @@ -103,7 +103,7 @@ describe('Transfer', () => { it('exits with error when both --to and --from are provided', async () => { await expectExit(1, async () => { - await transferCommand({ from: sourceUrl, to: destinationUrl }); + await transferAction({ from: sourceUrl, to: destinationUrl }); }); expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/one source/i)); @@ -116,7 +116,7 @@ describe('Transfer', () => { describe('--to', () => { it('exits with error when auth is not provided', async () => { await expectExit(1, async () => { - await transferCommand({ from: undefined, to: destinationUrl }); + await transferAction({ from: undefined, to: destinationUrl }); }); expect(console.error).toHaveBeenCalledWith(expect.stringMatching(/missing token/i)); @@ -128,7 +128,7 @@ describe('Transfer', () => { it('uses destination url and token provided by user', async () => { await expectExit(0, async () => { - await transferCommand({ from: undefined, to: destinationUrl, toToken: destinationToken }); + await transferAction({ from: undefined, to: destinationUrl, toToken: destinationToken }); }); expect(console.error).not.toHaveBeenCalled(); @@ -147,7 +147,7 @@ describe('Transfer', () => { it('uses local Strapi source when from is not specified', async () => { await expectExit(0, async () => { - await transferCommand({ from: undefined, to: destinationUrl, toToken: destinationToken }); + await transferAction({ from: undefined, to: destinationUrl, toToken: destinationToken }); }); expect(console.error).not.toHaveBeenCalled(); @@ -162,7 +162,7 @@ describe('Transfer', () => { it('uses restore as the default strategy', async () => { await expectExit(0, async () => { - await transferCommand({ from: undefined, to: destinationUrl, toToken: destinationToken }); + await transferAction({ from: undefined, to: destinationUrl, toToken: destinationToken }); }); expect(console.error).not.toHaveBeenCalled(); diff --git a/packages/core/strapi/lib/commands/actions/build/command.js b/packages/core/strapi/lib/commands/actions/build/command.js index c819cb8ce5..9f972b81dd 100644 --- a/packages/core/strapi/lib/commands/actions/build/command.js +++ b/packages/core/strapi/lib/commands/actions/build/command.js @@ -11,5 +11,5 @@ module.exports = ({ command }) => { .command('build') .option('--no-optimization', 'Build the admin app without optimizing assets') .description('Build the strapi admin app') - .action(getLocalScript('build-action')); // TODO: fix gitignore so that this folder can be called build + .action(getLocalScript('build')); }; diff --git a/packages/core/strapi/lib/commands/index.js b/packages/core/strapi/lib/commands/index.js index 8768947e94..aa931000c3 100644 --- a/packages/core/strapi/lib/commands/index.js +++ b/packages/core/strapi/lib/commands/index.js @@ -5,7 +5,7 @@ const { Command } = require('commander'); const availableCommands = [ 'admin/create-user', 'admin/reset-user-password', - 'build-action', // TODO: this should be 'build' but that is ignored + 'build', 'configuration/dump', 'configuration/restore', 'console',