@constructor-io/constructorio-connect-cli 1.15.0 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/boilerplate-repo/test/templates/item/__snapshots__/.gitkeep +0 -0
- package/boilerplate-repo/test/templates/item/item.spec.mjs +11 -3
- package/boilerplate-repo/test/templates/item_group/__snapshots__/.gitkeep +0 -0
- package/boilerplate-repo/test/templates/item_group/item_group.spec.mjs +11 -3
- package/boilerplate-repo/test/templates/mapping/__snapshots__/.gitkeep +0 -0
- package/boilerplate-repo/test/templates/mapping/mapping.spec.mjs +31 -3
- package/boilerplate-repo/test/templates/variation/__snapshots__/.gitkeep +0 -0
- package/boilerplate-repo/test/templates/variation/variation.spec.mjs +11 -3
- package/dist/functions/build-fixture.d.ts +2 -2
- package/dist/functions/build-fixture.d.ts.map +1 -1
- package/dist/functions/build-fixture.js +6 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
File without changes
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check out the documentation to see how to write and maintain tests:
|
|
3
3
|
* @see https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-development-flow#step-3-test-your-templates
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { executeTemplate, buildFixture } from "@constructor-io/constructorio-connect-cli";
|
|
5
7
|
|
|
6
8
|
describe("item", () => {
|
|
7
|
-
it("should
|
|
8
|
-
|
|
9
|
+
it("should match snapshot", async () => {
|
|
10
|
+
const result = await executeTemplate({
|
|
11
|
+
type: "item",
|
|
12
|
+
name: "item.jsonata",
|
|
13
|
+
fixture: buildFixture("item", "item.json"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(result).toMatchSnapshot();
|
|
9
17
|
});
|
|
10
18
|
});
|
|
File without changes
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check out the documentation to see how to write and maintain tests:
|
|
3
3
|
* @see https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-development-flow#step-3-test-your-templates
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { executeTemplate, buildFixture } from "@constructor-io/constructorio-connect-cli";
|
|
5
7
|
|
|
6
8
|
describe("item_group", () => {
|
|
7
|
-
it("should
|
|
8
|
-
|
|
9
|
+
it("should match snapshot", async () => {
|
|
10
|
+
const result = await executeTemplate({
|
|
11
|
+
type: "item_group",
|
|
12
|
+
name: "item_group.jsonata",
|
|
13
|
+
fixture: buildFixture("item_group", "item_group.json"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(result).toMatchSnapshot();
|
|
9
17
|
});
|
|
10
18
|
});
|
|
File without changes
|
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check out the documentation to see how to write and maintain tests:
|
|
3
3
|
* @see https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-development-flow#step-3-test-your-templates
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { executeTemplate, buildFixture } from "@constructor-io/constructorio-connect-cli";
|
|
5
7
|
|
|
6
8
|
describe("mapping", () => {
|
|
7
|
-
it("should
|
|
8
|
-
|
|
9
|
+
it("should map item groups", async () => {
|
|
10
|
+
const result = await executeTemplate({
|
|
11
|
+
type: "mapping",
|
|
12
|
+
name: "mapping.jsonata",
|
|
13
|
+
fixture: buildFixture("mapping", "mapping.json"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(result.item_groups).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should map items", async () => {
|
|
20
|
+
const result = await executeTemplate({
|
|
21
|
+
type: "mapping",
|
|
22
|
+
name: "mapping.jsonata",
|
|
23
|
+
fixture: buildFixture("mapping", "mapping.json"),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
expect(result.items).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should map variations", async () => {
|
|
30
|
+
const result = await executeTemplate({
|
|
31
|
+
type: "mapping",
|
|
32
|
+
name: "mapping.jsonata",
|
|
33
|
+
fixture: buildFixture("mapping", "mapping.json"),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
expect(result.variations).toMatchSnapshot();
|
|
9
37
|
});
|
|
10
38
|
});
|
|
File without changes
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check out the documentation to see how to write and maintain tests:
|
|
3
3
|
* @see https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-development-flow#step-3-test-your-templates
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { executeTemplate, buildFixture } from "@constructor-io/constructorio-connect-cli";
|
|
5
7
|
|
|
6
8
|
describe("variation", () => {
|
|
7
|
-
it("should
|
|
8
|
-
|
|
9
|
+
it("should match snapshot", async () => {
|
|
10
|
+
const result = await executeTemplate({
|
|
11
|
+
type: "variation",
|
|
12
|
+
name: "variation.jsonata",
|
|
13
|
+
fixture: buildFixture("variation", "variation.json"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(result).toMatchSnapshot();
|
|
9
17
|
});
|
|
10
18
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @param type string The type of fixture
|
|
8
8
|
* @param name string The name/path of the fixture
|
|
9
9
|
* @param dataOverride string The data to override in the fixture
|
|
10
|
-
* @returns Record<string, unknown> The fixture data
|
|
10
|
+
* @returns Record<string, unknown> or Array<Record<string, unknown>> The fixture data
|
|
11
11
|
*/
|
|
12
|
-
export declare const buildFixture: (type: string, name: string, dataOverride?: Record<string, unknown>) => never;
|
|
12
|
+
export declare const buildFixture: (type: string, name: string, dataOverride?: Record<string, unknown>) => never[];
|
|
13
13
|
//# sourceMappingURL=build-fixture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-fixture.d.ts","sourceRoot":"","sources":["../../src/functions/build-fixture.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,eAAc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,
|
|
1
|
+
{"version":3,"file":"build-fixture.d.ts","sourceRoot":"","sources":["../../src/functions/build-fixture.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,eAAc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,YAW3C,CAAC"}
|
|
@@ -16,10 +16,15 @@ const file_loaders_1 = require("../helpers/file-loaders");
|
|
|
16
16
|
* @param type string The type of fixture
|
|
17
17
|
* @param name string The name/path of the fixture
|
|
18
18
|
* @param dataOverride string The data to override in the fixture
|
|
19
|
-
* @returns Record<string, unknown> The fixture data
|
|
19
|
+
* @returns Record<string, unknown> or Array<Record<string, unknown>> The fixture data
|
|
20
20
|
*/
|
|
21
21
|
const buildFixture = (type, name, dataOverride = {}) => {
|
|
22
22
|
const data = (0, file_loaders_1.getCatalogFixture)(path_1.default.join(type, name));
|
|
23
|
+
if (Array.isArray(data)) {
|
|
24
|
+
return data.map((item) => {
|
|
25
|
+
return (0, remeda_1.mergeDeep)(item, dataOverride);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
23
28
|
return (0, remeda_1.mergeDeep)(data, dataOverride);
|
|
24
29
|
};
|
|
25
30
|
exports.buildFixture = buildFixture;
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED