Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 0feb3713a8f2e4a8a1f5f528218c2c578265dc5b31ff283a283fefc949bbafd2
checksum: 6753b1344b2f6ae505a1815ac6e4fc42f4da13e69851c66e6786400364281754
version: ""
20 changes: 19 additions & 1 deletion packages/contentstack-export/src/commands/cm/stacks/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,25 @@ export default class ExportCommand extends Command {
}),
module: flags.string({
description:
'[optional] Specific module name. If not specified, the export command will export all the modules to the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, taxonomies, and studio.',
'[optional] Specific module name. If not specified, the export command will export all the modules from the stack. The available modules are stack, assets, locales, environments, extensions, webhooks, global-fields, entries, content-types, custom-roles, workflows, labels, marketplace-apps, taxonomies, personalize, and composable-studio.',
options: [
'stack',
'assets',
'locales',
'environments',
'extensions',
'webhooks',
'global-fields',
'entries',
'content-types',
'custom-roles',
'workflows',
'labels',
'marketplace-apps',
'taxonomies',
'personalize',
'composable-studio',
],
}),
'content-types': flags.string({
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { expect } from 'chai';
import sinon from 'sinon';
import ExportCommand from '../../../../../src/commands/cm/stacks/export';

describe('ExportCommand', () => {
afterEach(() => {
sinon.restore();
});

describe('Flags Configuration', () => {
it('should have all required flags defined', () => {
const flags = ExportCommand.flags;

expect(flags).to.have.property('stack-api-key');
expect(flags).to.have.property('data-dir');
expect(flags).to.have.property('alias');
expect(flags).to.have.property('config');
expect(flags).to.have.property('module');
expect(flags).to.have.property('branch');
expect(flags).to.have.property('branch-alias');
expect(flags).to.have.property('secured-assets');
});

it('should have correct exclusive flags for branch', () => {
const flags = ExportCommand.flags;

expect(flags['branch']).to.have.property('exclusive');
expect(flags['branch-alias']).to.have.property('exclusive');
expect((flags['branch'] as any).exclusive).to.include('branch-alias');
expect((flags['branch-alias'] as any).exclusive).to.include('branch');
});
});

describe('module flag options', () => {
it('should have options defined on the module flag', () => {
const flags = ExportCommand.flags;

expect(flags['module']).to.have.property('options');
expect((flags['module'] as any).options).to.be.an('array').that.is.not.empty;
});

it('should accept all valid module names', () => {
const validModules = [
'stack',
'assets',
'locales',
'environments',
'extensions',
'webhooks',
'global-fields',
'entries',
'content-types',
'custom-roles',
'workflows',
'labels',
'marketplace-apps',
'taxonomies',
'personalize',
'composable-studio',
];
const moduleOptions = (ExportCommand.flags['module'] as any).options as string[];

for (const mod of validModules) {
expect(moduleOptions).to.include(mod, `module flag options should include '${mod}'`);
}
});

it('should not accept invalid module names', () => {
const moduleOptions = (ExportCommand.flags['module'] as any).options as string[];

expect(moduleOptions).to.not.include('invalid-module');
expect(moduleOptions).to.not.include('foo');
expect(moduleOptions).to.not.include('');
});

it('should have the correct number of valid modules', () => {
const moduleOptions = (ExportCommand.flags['module'] as any).options as string[];

expect(moduleOptions).to.have.lengthOf(16);
});
});
});
20 changes: 19 additions & 1 deletion packages/contentstack-import/src/commands/cm/stacks/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,25 @@ export default class ImportCommand extends Command {
module: flags.string({
required: false,
description:
'[optional] Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, personalize projects, taxonomies, and composable-studio.',
'[optional] Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are stack, assets, locales, environments, extensions, webhooks, global-fields, entries, content-types, custom-roles, workflows, labels, marketplace-apps, taxonomies, personalize, and composable-studio.',
options: [
'stack',
'assets',
'locales',
'environments',
'extensions',
'webhooks',
'global-fields',
'entries',
'content-types',
'custom-roles',
'workflows',
'labels',
'marketplace-apps',
'taxonomies',
'personalize',
'composable-studio',
],
}),
'backup-dir': flags.string({
description: '[optional] Backup directory name when using specific module.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,47 @@ describe('ImportCommand', () => {
expect((flags['import-webhook-status'] as any).options).to.include('disable');
expect((flags['import-webhook-status'] as any).options).to.include('current');
});

it('should have options defined on the module flag', () => {
const flags = ImportCommand.flags;

expect(flags['module']).to.have.property('options');
expect((flags['module'] as any).options).to.be.an('array').that.is.not.empty;
});

it('should accept all valid module names', () => {
const validModules = [
'stack',
'assets',
'locales',
'environments',
'extensions',
'webhooks',
'global-fields',
'entries',
'content-types',
'custom-roles',
'workflows',
'labels',
'marketplace-apps',
'taxonomies',
'personalize',
'composable-studio',
];
const moduleOptions = (ImportCommand.flags['module'] as any).options as string[];

for (const mod of validModules) {
expect(moduleOptions).to.include(mod, `module flag options should include '${mod}'`);
}
});

it('should not accept invalid module names', () => {
const moduleOptions = (ImportCommand.flags['module'] as any).options as string[];

expect(moduleOptions).to.not.include('invalid-module');
expect(moduleOptions).to.not.include('foo');
expect(moduleOptions).to.not.include('');
});
});

describe('createImportContext', () => {
Expand Down
Loading
Loading