Skip to content

Commit

Permalink
uncomment test cases
Browse files Browse the repository at this point in the history
Signed-off-by: srikant <[email protected]>
  • Loading branch information
srikant-ch5 committed Jan 8, 2025
1 parent 30b7f47 commit be033c1
Showing 1 changed file with 135 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,116 +29,116 @@ import actionResource from "./../../test_resources/json/form-actions-test.json";
const buttons = [{ id: "ok", text: "OK", isPrimary: true, url: "" }, { id: "cancel", text: "Cancel", isPrimary: false, url: "" }];

describe("Correct form should be created", () => {
// it("should create a form with basic options", () => {
// const generatedForm = Form.makeForm(formResource.paramDef);
// // console.info("Expected: " + JSON.stringify(formResource.expectedResult));
// // console.info("Actual : " + JSON.stringify(generatedForm));
// // console.info("\n\n");
// // Work around since comparing the objects directly doesn't work.
// expect(isEqual(JSON.parse(JSON.stringify(formResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
it("should create a form with basic options", () => {
const generatedForm = Form.makeForm(formResource.paramDef);
// console.info("Expected: " + JSON.stringify(formResource.expectedResult));
// console.info("Actual : " + JSON.stringify(generatedForm));
// console.info("\n\n");
// Work around since comparing the objects directly doesn't work.
expect(isEqual(JSON.parse(JSON.stringify(formResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

// it("should create a form with minimum paramSpec options", () => {
// const primaryTabs = {
// "itemType": "primaryTabs",
// "tabs": [
// {
// "text": "settings",
// "group": "settings",
// "content": {
// "itemType": "panel",
// "panel": {
// "id": "settings",
// "panelType": "general",
// "nestedPanel": false,
// "uiItems": [
// {
// "itemType": "control",
// "control": {
// "name": "boolean_param",
// "label": {
// "text": "boolean_param"
// },
// "light": true,
// "labelVisible": false,
// "controlType": "checkbox",
// "valueDef": {
// "propType": "boolean",
// "isList": false,
// "isMap": false
// },
// "values": [
// true,
// false
// ],
// "valueLabels": [
// "true",
// "false"
// ],
// "valueDescs": [
// null,
// null
// ]
// }
// }
// ],
// "open": false,
// }
// }
// }
// ]
// };
// const data = {
// "currentParameters": {
// "boolean_param": true
// }
// };
// let help;
// let description;
// let pixelWidth; // Pass in an undefined pixelWidth to simulate it missing from ParamDefs.
// let conditions;
// let resources;
// const expectedForm = new Form("TestOp", "TestOp", true, help, description, "small", pixelWidth, [primaryTabs], buttons, data, conditions, resources, "./test.svg");
it("should create a form with minimum paramSpec options", () => {
const primaryTabs = {
"itemType": "primaryTabs",
"tabs": [
{
"text": "settings",
"group": "settings",
"content": {
"itemType": "panel",
"panel": {
"id": "settings",
"panelType": "general",
"nestedPanel": false,
"uiItems": [
{
"itemType": "control",
"control": {
"name": "boolean_param",
"label": {
"text": "boolean_param"
},
"light": true,
"labelVisible": false,
"controlType": "checkbox",
"valueDef": {
"propType": "boolean",
"isList": false,
"isMap": false
},
"values": [
true,
false
],
"valueLabels": [
"true",
"false"
],
"valueDescs": [
null,
null
]
}
}
],
"open": false,
}
}
}
]
};
const data = {
"currentParameters": {
"boolean_param": true
}
};
let help;
let description;
let pixelWidth; // Pass in an undefined pixelWidth to simulate it missing from ParamDefs.
let conditions;
let resources;
const expectedForm = new Form("TestOp", "TestOp", true, help, description, "small", pixelWidth, [primaryTabs], buttons, data, conditions, resources, "./test.svg");

// const paramSpec = {
// "current_parameters": {
// "boolean_param": true
// },
// "titleDefinition": {
// "title": "TestOp"
// },
// "parameters": [
// {
// "id": "boolean_param",
// "type": "boolean"
// }
// ],
// "uihints": {
// "id": "TestOp",
// "icon": "./test.svg",
// "editor_size": "small",
// "group_info": [
// {
// "id": "settings",
// "parameter_refs": ["boolean_param"]
// }
// ]
// }
// };
// const generatedForm = Form.makeForm(paramSpec);
// // console.info("Expected: " + JSON.stringify(expectedForm, null, 2));
// // console.info("Actual : " + JSON.stringify(generatedForm, null, 2));
// // console.info("\n\n");
// expect(isEqual(JSON.parse(JSON.stringify(expectedForm)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
const paramSpec = {
"current_parameters": {
"boolean_param": true
},
"titleDefinition": {
"title": "TestOp"
},
"parameters": [
{
"id": "boolean_param",
"type": "boolean"
}
],
"uihints": {
"id": "TestOp",
"icon": "./test.svg",
"editor_size": "small",
"group_info": [
{
"id": "settings",
"parameter_refs": ["boolean_param"]
}
]
}
};
const generatedForm = Form.makeForm(paramSpec);
// console.info("Expected: " + JSON.stringify(expectedForm, null, 2));
// console.info("Actual : " + JSON.stringify(generatedForm, null, 2));
// console.info("\n\n");
expect(isEqual(JSON.parse(JSON.stringify(expectedForm)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

// it("should create a form with a structure", () => {
// const generatedForm = Form.makeForm(formStructuredTable.paramDef);
// // console.info("Expected: " + JSON.stringify(formStructuredTable.expectedResult));
// // console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// // console.info("\n\n");
// expect(isEqual(JSON.parse(JSON.stringify(formStructuredTable.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
it("should create a form with a structure", () => {
const generatedForm = Form.makeForm(formStructuredTable.paramDef);
// console.info("Expected: " + JSON.stringify(formStructuredTable.expectedResult));
// console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// console.info("\n\n");
expect(isEqual(JSON.parse(JSON.stringify(formStructuredTable.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

it("should create a form with a structure with moveable_rows and value_icons", () => {
const generatedForm = Form.makeForm(formStructuredTable2.paramDef);
Expand All @@ -148,36 +148,36 @@ describe("Correct form should be created", () => {
expect(isEqual(JSON.parse(JSON.stringify(formStructuredTable2.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

// it("should create a form with translated condition message", () => {
// const generatedForm = Form.makeForm(conditionResource.paramDef);
// // console.info("Expected: " + JSON.stringify(conditionResource.expectedResult));
// // console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// // console.info("\n\n");
// expect(isEqual(JSON.parse(JSON.stringify(conditionResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
it("should create a form with translated condition message", () => {
const generatedForm = Form.makeForm(conditionResource.paramDef);
// console.info("Expected: " + JSON.stringify(conditionResource.expectedResult));
// console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// console.info("\n\n");
expect(isEqual(JSON.parse(JSON.stringify(conditionResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

// it("should create a form with editStyle set to subpanel and checkbox panel", () => {
// const generatedForm = Form.makeForm(editStyleResource.paramDef);
// // console.info("Expected: " + JSON.stringify(editStyleResource.expectedResult));
// // console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// // console.info("\n\n");
// expect(isEqual(JSON.parse(JSON.stringify(editStyleResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
it("should create a form with editStyle set to subpanel and checkbox panel", () => {
const generatedForm = Form.makeForm(editStyleResource.paramDef);
// console.info("Expected: " + JSON.stringify(editStyleResource.expectedResult));
// console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// console.info("\n\n");
expect(isEqual(JSON.parse(JSON.stringify(editStyleResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

// it("should create a form with description placement set to on_panel", () => {
// const generatedForm = Form.makeForm(placementResource.paramDef);
// // console.info("Expected: " + JSON.stringify(placementResource.expectedResult));
// // console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// // console.info("\n\n");
// expect(isEqual(JSON.parse(JSON.stringify(placementResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
it("should create a form with description placement set to on_panel", () => {
const generatedForm = Form.makeForm(placementResource.paramDef);
// console.info("Expected: " + JSON.stringify(placementResource.expectedResult));
// console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// console.info("\n\n");
expect(isEqual(JSON.parse(JSON.stringify(placementResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

// it("should create a form with actions and summaryPanel", () => {
// const generatedForm = Form.makeForm(actionResource.paramDef);
// // console.info("Expected: " + JSON.stringify(actionResource.expectedResult));
// // console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// // console.info("\n\n");
// expect(isEqual(JSON.parse(JSON.stringify(actionResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
// });
it("should create a form with actions and summaryPanel", () => {
const generatedForm = Form.makeForm(actionResource.paramDef);
// console.info("Expected: " + JSON.stringify(actionResource.expectedResult));
// console.info("Actual : " + JSON.stringify(generatedForm) + "\n\n");
// console.info("\n\n");
expect(isEqual(JSON.parse(JSON.stringify(actionResource.expectedResult)), JSON.parse(JSON.stringify(generatedForm)))).to.be.true;
});

});

0 comments on commit be033c1

Please sign in to comment.