@ondc/automation-mock-runner 0.1.1 → 0.1.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/dist/lib/configHelper.js
CHANGED
|
@@ -45,10 +45,12 @@ function convertToFlowConfig(config) {
|
|
|
45
45
|
if (step.mock.inputs !== undefined &&
|
|
46
46
|
step.mock.inputs !== null &&
|
|
47
47
|
Object.keys(step.mock.inputs).length > 0) {
|
|
48
|
-
flowStep.input =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
flowStep.input = [
|
|
49
|
+
{
|
|
50
|
+
name: step.mock.inputs.id,
|
|
51
|
+
schema: step.mock.inputs.jsonSchema,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
52
54
|
}
|
|
53
55
|
flowConfig.sequence.push(flowStep);
|
|
54
56
|
index++;
|
|
@@ -555,27 +555,29 @@ describe("configHelper", () => {
|
|
|
555
555
|
const result = (0, configHelper_1.convertToFlowConfig)(testMockConfig);
|
|
556
556
|
// Find the step with inputs (on_search_test)
|
|
557
557
|
const stepWithInputs = result.sequence.find((s) => s.key === "on_search_test");
|
|
558
|
-
expect(stepWithInputs.input).toEqual(
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
558
|
+
expect(stepWithInputs.input).toEqual([
|
|
559
|
+
{
|
|
560
|
+
name: "ExampleInputId",
|
|
561
|
+
schema: {
|
|
562
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
563
|
+
type: "object",
|
|
564
|
+
properties: {
|
|
565
|
+
item_id: {
|
|
566
|
+
type: "string",
|
|
567
|
+
description: "item id",
|
|
568
|
+
},
|
|
569
|
+
item_count: {
|
|
570
|
+
type: "integer",
|
|
571
|
+
minimum: 0,
|
|
572
|
+
maximum: 12,
|
|
573
|
+
description: "item count",
|
|
574
|
+
},
|
|
575
|
+
required: ["item_id", "item_count"],
|
|
576
|
+
additionalProperties: false,
|
|
573
577
|
},
|
|
574
|
-
required: ["item_id", "item_count"],
|
|
575
|
-
additionalProperties: false,
|
|
576
578
|
},
|
|
577
579
|
},
|
|
578
|
-
|
|
580
|
+
]);
|
|
579
581
|
});
|
|
580
582
|
it("should handle steps without inputs", () => {
|
|
581
583
|
const result = (0, configHelper_1.convertToFlowConfig)(testMockConfig);
|
|
@@ -679,8 +681,8 @@ describe("configHelper", () => {
|
|
|
679
681
|
],
|
|
680
682
|
};
|
|
681
683
|
const result = (0, configHelper_1.convertToFlowConfig)(configWithComplexInputs);
|
|
682
|
-
expect(result.sequence[0].input.name).toBe("ComplexInputId");
|
|
683
|
-
expect(result.sequence[0].input.schema.properties.nested).toBeDefined();
|
|
684
|
+
expect(result.sequence[0].input[0].name).toBe("ComplexInputId");
|
|
685
|
+
expect(result.sequence[0].input[0].schema.properties.nested).toBeDefined();
|
|
684
686
|
});
|
|
685
687
|
});
|
|
686
688
|
});
|