Skip to content

Commit e49bdfd

Browse files
authored
Merge pull request #1649 from contentstack/fix/DX-1358-fix-development
fixed existing test cases for running
2 parents 0bab278 + 87b5650 commit e49bdfd

File tree

8 files changed

+302
-216
lines changed

8 files changed

+302
-216
lines changed

package-lock.json

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

packages/contentstack-migration/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"async": "^3.2.6",
1010
"callsites": "^3.1.0",
1111
"cardinal": "^2.1.1",
12-
"chalk": "^4.1.0",
12+
"chalk": "^4.1.2",
13+
"concat-stream": "^2.0.0",
1314
"dot-object": "^2.1.5",
1415
"dotenv": "^16.4.5",
1516
"listr": "^0.14.3",
@@ -18,15 +19,15 @@
1819
"devDependencies": {
1920
"@oclif/test": "^2.5.6",
2021
"chai": "^4.5.0",
21-
"eslint": "^8.18.0",
22+
"eslint": "^8.57.1",
2223
"globby": "^10.0.2",
2324
"husky": "^8.0.3",
24-
"jsdoc": "^4.0.3",
25+
"jsdoc": "^4.0.4",
2526
"jsdoc-to-markdown": "^8.0.3",
2627
"mkdirp": "^1.0.4",
2728
"nock": "^13.5.5",
2829
"nyc": "^15.1.0",
29-
"oclif": "^3.11.3"
30+
"oclif": "^3.17.2"
3031
},
3132
"engines": {
3233
"node": ">=8.3.0"

packages/contentstack-migration/test/commands/create-content-type.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('Create content type from migration script', () => {
1212
describe('Create content type with passing options as arguments', () => {
1313
nockBack('create-content-type.json', (nockDone) => {
1414
test
15+
.loadConfig({ root: process.cwd() })
1516
.stdout()
1617
.command([
1718
'cm:migration',
@@ -27,6 +28,7 @@ describe('Create content type from migration script', () => {
2728
});
2829

2930
test
31+
.loadConfig({ root: process.cwd() })
3032
.stdout()
3133
.command([
3234
'cm:migration',
@@ -42,6 +44,7 @@ describe('Create content type from migration script', () => {
4244
});
4345

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

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

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

9095
nockBack('missing-required-field.json', (nockDone) => {
9196
test
97+
.loadConfig({ root: process.cwd() })
9298
.stdout()
9399
.command([
94100
'cm:migration',

packages/contentstack-migration/test/commands/delete-field.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('Delete field test from migration script', () => {
1313

1414
describe('prepare for field test', () => {
1515
test
16+
.loadConfig({ root: process.cwd() })
1617
.command([
1718
'cm:migration',
1819
'-n',
@@ -27,6 +28,7 @@ describe('Delete field test from migration script', () => {
2728
describe('Delete field', () => {
2829
nockBack('delete-field.json', (nockDone) => {
2930
test
31+
.loadConfig({ root: process.cwd() })
3032
.stdout()
3133
.command([
3234
'cm:migration',
@@ -42,6 +44,7 @@ describe('Delete field test from migration script', () => {
4244
});
4345

4446
test
47+
.loadConfig({ root: process.cwd() })
4548
.stdout()
4649
.command([
4750
'cm:migration',
@@ -60,6 +63,7 @@ describe('Delete field test from migration script', () => {
6063

6164
describe('wind up field test', () => {
6265
test
66+
.loadConfig({ root: process.cwd() })
6367
.command([
6468
'cm:migration',
6569
'-n',

packages/contentstack-migration/test/commands/edit-content-type.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe('Edit content type from migration script', () => {
1111
nockBack.setMode('record');
1212
describe('prepare for edit field test', () => {
1313
test
14+
.loadConfig({ root: process.cwd() })
1415
.command([
1516
'cm:migration',
1617
'-n',
@@ -25,6 +26,7 @@ describe('Edit content type from migration script', () => {
2526
describe('Allow editing existing content type', () => {
2627
nockBack('edit-content-type.json', (nockDone) => {
2728
test
29+
.loadConfig({ root: process.cwd() })
2830
.stdout()
2931
.command([
3032
'cm:migration',
@@ -40,6 +42,7 @@ describe('Edit content type from migration script', () => {
4042
});
4143

4244
test
45+
.loadConfig({ root: process.cwd() })
4346
.stdout()
4447
.command([
4548
'cm:migration',
@@ -63,6 +66,7 @@ describe('Edit content type from migration script', () => {
6366
// })
6467

6568
test
69+
.loadConfig({ root: process.cwd() })
6670
.stdout()
6771
.command([
6872
'cm:migration',
@@ -80,6 +84,7 @@ describe('Edit content type from migration script', () => {
8084
});
8185
describe('wind up field test', () => {
8286
test
87+
.loadConfig({ root: process.cwd() })
8388
.command([
8489
'cm:migration',
8590
'-n',
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
"use strict";
1+
'use strict';
22

3-
const { constants } = require("../setup");
3+
const { constants } = require('../setup');
44
const { migrationPath } = constants;
5-
const path = require("path");
6-
const nockBack = require("nock").back;
7-
const { expect, test } = require("@oclif/test");
5+
const path = require('path');
6+
const nockBack = require('nock').back;
7+
const { expect, test } = require('@oclif/test');
88

9-
describe("Edit field test", () => {
10-
nockBack.fixtures = path.join(__dirname, "__nock-fixtures__");
11-
nockBack.setMode("record");
12-
describe("prepare for edit field test", () => {
9+
describe('Edit field test', () => {
10+
nockBack.fixtures = path.join(__dirname, '__nock-fixtures__');
11+
nockBack.setMode('record');
12+
describe('prepare for edit field test', () => {
1313
test
14+
.loadConfig({ root: process.cwd() })
1415
.command([
15-
"cm:migration",
16-
"-n",
16+
'cm:migration',
17+
'-n',
1718
`${migrationPath}/create-ct/create-ct-opts.js`,
18-
"-A",
19-
"-k",
20-
"bltmock9e992a923aafdmock521adc4b5b3",
19+
'-A',
20+
'-k',
21+
'bltmock9e992a923aafdmock521adc4b5b3',
2122
])
22-
.it("Should create content type", () => {});
23+
.it('Should create content type', () => {});
2324
});
24-
describe("prepare for edit field test", () => {
25-
nockBack("edit-field.json", (nockDone) => {
25+
describe('prepare for edit field test', () => {
26+
nockBack('edit-field.json', (nockDone) => {
2627
test
28+
.loadConfig({ root: process.cwd() })
2729
.stdout()
2830
.command([
29-
"cm:migration",
30-
"-n",
31+
'cm:migration',
32+
'-n',
3133
`${migrationPath}/edit-field/edit-field.js`,
32-
"-A",
33-
"-k",
34-
"bltmock9e992a923aafdmock521adc4b5b3",
34+
'-A',
35+
'-k',
36+
'bltmock9e992a923aafdmock521adc4b5b3',
3537
])
36-
.it("Should edit the field successfully for content type", (ctx) => {
37-
expect(ctx.stdout).to.contains(
38-
"Successfully updated content type: foo3"
39-
);
38+
.it('Should edit the field successfully for content type', (ctx) => {
39+
expect(ctx.stdout).to.contains('Successfully updated content type: foo3');
4040
nockDone();
4141
});
4242

@@ -49,33 +49,33 @@ describe("Edit field test", () => {
4949
// })
5050

5151
test
52+
.loadConfig({ root: process.cwd() })
5253
.stdout()
5354
.command([
54-
"cm:migration",
55-
"-n",
55+
'cm:migration',
56+
'-n',
5657
`${migrationPath}/edit-field/edit-invalid-method.js`,
57-
"-A",
58-
"-k",
59-
"bltmock9e992a923aafdmock521adc4b5b3",
58+
'-A',
59+
'-k',
60+
'bltmock9e992a923aafdmock521adc4b5b3',
6061
])
61-
.it("Should show error message invalid method access", (ctx) => {
62-
expect(ctx.stdout).to.contains(
63-
" display_nam is not a valid function"
64-
);
62+
.it('Should show error message invalid method access', (ctx) => {
63+
expect(ctx.stdout).to.contains(' display_nam is not a valid function');
6564
nockDone();
6665
});
6766
});
6867
});
69-
describe("wind up field test", () => {
68+
describe('wind up field test', () => {
7069
test
70+
.loadConfig({ root: process.cwd() })
7171
.command([
72-
"cm:migration",
73-
"-n",
72+
'cm:migration',
73+
'-n',
7474
`${migrationPath}/edit-ct/delete-ct.js`,
75-
"-A",
76-
"-k",
77-
"bltmock9e992a923aafdmock521adc4b5b3",
75+
'-A',
76+
'-k',
77+
'bltmock9e992a923aafdmock521adc4b5b3',
7878
])
79-
.it("Should delete content type", () => {});
79+
.it('Should delete content type', () => {});
8080
});
8181
});

packages/contentstack-migration/test/commands/move-field.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe("Move field test from migration script", () => {
1111
nockBack.setMode("record");
1212
describe("prepare for edit field test", () => {
1313
test
14+
.loadConfig({ root: process.cwd() })
1415
.command([
1516
"cm:migration",
1617
"-n",
@@ -24,6 +25,7 @@ describe("Move field test from migration script", () => {
2425
describe("Move field", () => {
2526
nockBack("move-field.json", (nockDone) => {
2627
test
28+
.loadConfig({ root: process.cwd() })
2729
.stdout()
2830
.command([
2931
"cm:migration",
@@ -41,6 +43,7 @@ describe("Move field test from migration script", () => {
4143
});
4244

4345
test
46+
.loadConfig({ root: process.cwd() })
4447
.stdout()
4548
.command([
4649
"cm:migration",
@@ -58,6 +61,7 @@ describe("Move field test from migration script", () => {
5861
});
5962
describe("wind up field test", () => {
6063
test
64+
.loadConfig({ root: process.cwd() })
6165
.command([
6266
"cm:migration",
6367
"-n",

0 commit comments

Comments
 (0)