Skip to content

Commit

Permalink
Merge branch 'development' into variants-bulk-publish-and-unpublish
Browse files Browse the repository at this point in the history
  • Loading branch information
sunil-lakshman committed Oct 31, 2024
1 parent 04e2016 commit ffd3c7a
Show file tree
Hide file tree
Showing 10 changed files with 567 additions and 551 deletions.
724 changes: 334 additions & 390 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions packages/contentstack-migrate-rte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
"dependencies": {
"@contentstack/cli-command": "~1.3.2",
"@contentstack/cli-utilities": "~1.8.0",
"@contentstack/json-rte-serializer": "~2.0.4",
"@contentstack/json-rte-serializer": "~2.0.10",
"collapse-whitespace": "^1.1.7",
"chalk": "^4.1.2",
"jsdom": "^20.0.3",
"jsonschema": "^1.4.0",
"jsonschema": "^1.4.1",
"lodash": "^4.17.21",
"nock": "^13.1.0",
"omit-deep-lodash": "^1.1.5",
"sinon": "^19.0.0",
"nock": "^13.5.5",
"omit-deep-lodash": "^1.1.7",
"sinon": "^19.0.2",
"uuid": "^9.0.1"
},
"devDependencies": {
"@oclif/test": "^2.5.6",
"chai": "^4.3.4",
"eslint": "^8.18.0",
"chai": "^4.5.0",
"eslint": "^8.57.1",
"eslint-config-oclif": "^4.0.0",
"globby": "^10.0.2",
"mocha": "^10.0.0",
"mocha": "^10.7.3",
"nyc": "^15.1.0",
"oclif": "^3.11.3",
"tslib": "^1.13.0"
"oclif": "^3.17.2",
"tslib": "^1.14.1"
},
"engines": {
"node": ">=14.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('Migration Config validation', () => {
.throws("Token with alias 'invalidAlias' was not found");

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => false)
.stdout()
.command([
Expand All @@ -50,6 +51,7 @@ describe('Migration Config validation', () => {
.it('deny config confirmation');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -60,6 +62,7 @@ describe('Migration Config validation', () => {
.it('throw error on Empty paths');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -70,6 +73,7 @@ describe('Migration Config validation', () => {
.it('throw error on invalid config type');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stdout()
.command([
Expand All @@ -89,6 +93,7 @@ describe('Migration Config validation', () => {
.it('throw error on config without alias property');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -111,6 +116,7 @@ describe('Migration Config validation', () => {
.it('throw error on invalidAlias');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down Expand Up @@ -269,6 +275,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
});

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -278,6 +285,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
});

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -287,6 +295,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
});

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -295,6 +304,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
expect(ctx.stdout).to.contain('Updated 1 Content Type(s) and 3 Entrie(s)');
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -316,6 +326,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
});

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -338,6 +349,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
expect(ctx.stdout).to.contain('Updated 1 Content Type(s) and 1 Entrie(s)');
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -361,6 +373,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on invalid html rte path');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -384,6 +397,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on invalid html rte field schema');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -406,6 +420,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
})
.it('throw error on invalid json rte field schema');
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -429,6 +444,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on invalid json rte path');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -444,6 +460,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on migration of Mutiple Html rte with single Json rte');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -467,6 +484,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on content type with empty schema');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -492,6 +510,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on different level rte migration');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -514,6 +533,7 @@ describe('Content Type with Single RTE Field of Single Type', function () {
.it('throw error on invalid contenttype');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => true)
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -537,15 +557,20 @@ describe('Content Type with Single RTE Field of Single Type', function () {
);
});

test
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
.command(['cm:entries:migrate-html-rte', '--config-path', './test/dummy/config/config-for-images-in-rte.json', '--yes'])
.command([
'cm:entries:migrate-html-rte',
'--config-path',
'./test/dummy/config/config-for-images-in-rte.json',
'--yes',
])
.it('should have proper json structure for images migrated from HTML RTE', (ctx) => {
expect(ctx.stdout).to.contain('Updated 1 Content Type(s) and 1 Entrie(s)');
});

});
describe('Global Field Migration', () => {
let token = getToken('test1');
Expand Down Expand Up @@ -574,6 +599,7 @@ describe('Global Field Migration', () => {
type: 'management',
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -583,6 +609,7 @@ describe('Global Field Migration', () => {
});

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -607,6 +634,7 @@ describe('Global Field Migration', () => {
.it('throw error on global field with empty referred content_types');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -633,6 +661,7 @@ describe('Global Field Migration', () => {
.it('throw error on global field with invalid content_type');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -657,6 +686,7 @@ describe('Global Field Migration', () => {
.it('throw error on global field with empty schema');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -683,6 +713,7 @@ describe('Global Field Migration', () => {
.it('throw error on global field with empty schema content_type');

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down Expand Up @@ -715,6 +746,7 @@ describe('Content Type with single rte of multiple type', () => {
type: 'management',
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand All @@ -732,6 +764,7 @@ describe('Content Type with Single RTE inside modular block', () => {
type: 'management',
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down Expand Up @@ -762,6 +795,7 @@ describe('Content Type with Single RTE of type multiple inside group', () => {
type: 'management',
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down Expand Up @@ -792,6 +826,7 @@ describe('Content Type with Single RTE inside group of type multiple', () => {
type: 'management',
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down Expand Up @@ -822,6 +857,7 @@ describe('Content Type with multiple file field', () => {
type: 'management',
});
test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down Expand Up @@ -865,6 +901,7 @@ describe('Migration with old flags and command', () => {
});

test
.loadConfig({ root: process.cwd() })
.stub(cliux, 'confirm', () => 'yes')
.stub(command, 'getToken', getTokenCallback)
.stdout()
Expand Down
9 changes: 5 additions & 4 deletions packages/contentstack-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"async": "^3.2.6",
"callsites": "^3.1.0",
"cardinal": "^2.1.1",
"chalk": "^4.1.0",
"chalk": "^4.1.2",
"concat-stream": "^2.0.0",
"dot-object": "^2.1.5",
"dotenv": "^16.4.5",
"listr": "^0.14.3",
Expand All @@ -18,15 +19,15 @@
"devDependencies": {
"@oclif/test": "^2.5.6",
"chai": "^4.5.0",
"eslint": "^8.18.0",
"eslint": "^8.57.1",
"globby": "^10.0.2",
"husky": "^8.0.3",
"jsdoc": "^4.0.3",
"jsdoc": "^4.0.4",
"jsdoc-to-markdown": "^8.0.3",
"mkdirp": "^1.0.4",
"nock": "^13.5.5",
"nyc": "^15.1.0",
"oclif": "^3.11.3"
"oclif": "^3.17.2"
},
"engines": {
"node": ">=8.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('Create content type from migration script', () => {
describe('Create content type with passing options as arguments', () => {
nockBack('create-content-type.json', (nockDone) => {
test
.loadConfig({ root: process.cwd() })
.stdout()
.command([
'cm:migration',
Expand All @@ -27,6 +28,7 @@ describe('Create content type from migration script', () => {
});

test
.loadConfig({ root: process.cwd() })
.stdout()
.command([
'cm:migration',
Expand All @@ -42,6 +44,7 @@ describe('Create content type from migration script', () => {
});

test
.loadConfig({ root: process.cwd() })
.stdout()
.command([
'cm:migration',
Expand All @@ -60,6 +63,7 @@ describe('Create content type from migration script', () => {

describe('should show error for misspelled properties', () => {
test
.loadConfig({ root: process.cwd() })
.stdout()
.command([
'cm:migration',
Expand All @@ -74,6 +78,7 @@ describe('Create content type from migration script', () => {
});

test
.loadConfig({ root: process.cwd() })
.stdout()
.command([
'cm:migration',
Expand All @@ -89,6 +94,7 @@ describe('Create content type from migration script', () => {

nockBack('missing-required-field.json', (nockDone) => {
test
.loadConfig({ root: process.cwd() })
.stdout()
.command([
'cm:migration',
Expand Down
Loading

0 comments on commit ffd3c7a

Please sign in to comment.