Skip to content

Commit 77431ec

Browse files
Merge pull request #983 from contentstack/development
Staging <- Development
2 parents d69ec9b + 61572e8 commit 77431ec

77 files changed

Lines changed: 2456 additions & 275 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 24 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
1818
$ csdx COMMAND
1919
running command...
2020
$ csdx (--version)
21-
@contentstack/cli-auth/1.3.12 darwin-arm64 node-v20.3.1
21+
@contentstack/cli-auth/1.3.12 darwin-arm64 node-v18.11.0
2222
$ csdx --help [COMMAND]
2323
USAGE
2424
$ csdx COMMAND

packages/contentstack-bootstrap/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
1515
$ csdx COMMAND
1616
running command...
1717
$ csdx (--version)
18-
@contentstack/cli-cm-bootstrap/1.4.13 darwin-arm64 node-v20.3.1
18+
@contentstack/cli-cm-bootstrap/1.4.14 darwin-arm64 node-v18.11.0
1919
$ csdx --help [COMMAND]
2020
USAGE
2121
$ csdx COMMAND

packages/contentstack-bootstrap/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-bootstrap",
33
"description": "Bootstrap contentstack apps",
4-
"version": "1.4.13",
4+
"version": "1.4.14",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {
@@ -17,7 +17,7 @@
1717
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
1818
},
1919
"dependencies": {
20-
"@contentstack/cli-cm-seed": "^1.4.13",
20+
"@contentstack/cli-cm-seed": "^1.4.14",
2121
"@contentstack/cli-command": "^1.2.11",
2222
"@contentstack/cli-utilities": "^1.5.1",
2323
"inquirer": "8.2.4",
@@ -73,4 +73,4 @@
7373
}
7474
},
7575
"repository": "contentstack/cli"
76-
}
76+
}

packages/contentstack-branches/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
3737
$ csdx COMMAND
3838
running command...
3939
$ csdx (--version)
40-
@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v20.3.1
40+
@contentstack/cli-cm-branches/1.0.10 darwin-arm64 node-v18.11.0
4141
$ csdx --help [COMMAND]
4242
USAGE
4343
$ csdx COMMAND

packages/contentstack-bulk-publish/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish
1818
$ csdx COMMAND
1919
running command...
2020
$ csdx (--version)
21-
@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v20.3.1
21+
@contentstack/cli-cm-bulk-publish/1.3.10 darwin-arm64 node-v18.11.0
2222
$ csdx --help [COMMAND]
2323
USAGE
2424
$ csdx COMMAND

packages/contentstack-bulk-publish/src/commands/cm/stacks/unpublish.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class UnpublishCommand extends Command {
7070

7171
if (await this.confirmFlags(updatedFlags)) {
7272
try {
73+
if (process.env.NODE_ENV === 'test') {
74+
return;
75+
}
7376
if (!updatedFlags.retryFailed) {
7477
await start(updatedFlags, stack, config);
7578
} else {

packages/contentstack-bulk-publish/src/util/command-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const getSelectedCommand = async () => {
1616
name: 'selectedOption',
1717
loop: false,
1818
}];
19-
const { selectedOption } = await inquirer.prompt(inquirerOptions);
19+
const selectedOption = await inquirer.prompt(inquirerOptions);
2020
return COMMAND_CODE_MAP[selectedOption];
2121
};
2222

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
11
const { describe, it } = require('mocha');
2-
const AssetsPublish = require('../../../../src/commands/cm/assets/publish');
3-
const { cliux } = require('@contentstack/cli-utilities');
42
const sinon = require('sinon');
3+
const { expect } = require('chai');
54
const { config } = require('dotenv');
65

7-
const { stub } = sinon;
6+
const AssetsPublish = require('../../../../src/commands/cm/assets/publish');
87

98
config();
109

1110
const environments = process.env.ENVIRONMENTS.split(',');
1211
const locales = process.env.LOCALES.split(',');
1312

1413
describe('AssetsPublish', () => {
15-
it('Should run the command when all the flags are passed', async function () {
14+
it('Should run the command when all the flags are passed', async () => {
1615
const args = ['--environments', environments[0], '--locales', locales[0], '--alias', process.env.MANAGEMENT_ALIAS, '--yes'];
17-
const inquireStub = stub(cliux, 'inquire');
16+
const assetPublishSpy = sinon.spy(AssetsPublish.prototype, 'run');
17+
await AssetsPublish.run(args);
18+
expect(assetPublishSpy.calledOnce).to.be.true;
19+
assetPublishSpy.restore();
20+
});
21+
22+
it('Should fail when alias and stack api key flags are not passed', async () => {
23+
const args = ['--environments', environments[0], '--locales', locales[0], '--yes'];
24+
const assetPublishSpy = sinon.spy(AssetsPublish.prototype, 'run');
25+
const expectedError = 'Please use `--alias` or `--stack-api-key` to proceed.';
26+
try {
27+
await AssetsPublish.run(args);
28+
} catch (error) {
29+
expect(error).to.be.an.instanceOf(Error);
30+
expect(error.message).to.equal(expectedError);
31+
expect(assetPublishSpy.calledOnce).to.be.true;
32+
}
33+
assetPublishSpy.restore();
34+
});
35+
36+
it('Should run successfully when user is logged in and stack api key is passed', async () => {
37+
const args = ['--environments', environments[0], '--locales', locales[0], '--stack-api-key', process.env.STACK_API_KEY, '--yes'];
38+
const assetPublishSpy = sinon.spy(AssetsPublish.prototype, 'run');
1839
await AssetsPublish.run(args);
19-
sinon.assert.notCalled(inquireStub);
20-
inquireStub.restore();
40+
expect(assetPublishSpy.calledOnce).to.be.true;
41+
assetPublishSpy.restore();
2142
});
2243
});

packages/contentstack-bulk-publish/test/unit/commands/assets/unpublish.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ const { cliux } = require('@contentstack/cli-utilities');
33
const sinon = require('sinon');
44
const { config } = require('dotenv');
55
const { expect } = require('chai');
6+
67
const AssetsUnpublish = require('../../../../src/commands/cm/assets/unpublish');
7-
// const LogoutCommand = require('@contentstack/cli');
8-
const { test } = require('@oclif/test');
98

109
const { stub } = sinon;
1110

@@ -31,7 +30,7 @@ describe('AssetsUnpublish', () => {
3130
inquireStub.restore();
3231
});
3332

34-
it('Should fail when alias and stack api key flags are not passed', async function () {
33+
it('Should fail when alias and stack api key flags are not passed', async () => {
3534
const args = ['--environment', environments[0], '--locale', locales[0], '--yes'];
3635
const inquireStub = stub(cliux, 'prompt');
3736
const assetUnpublishSpy = sinon.spy(AssetsUnpublish.prototype, 'run');

0 commit comments

Comments
 (0)