Skip to content

Commit

Permalink
Increase test coverage for getWorkflowInputs in .ga workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 28, 2024
1 parent e8c52f9 commit 5ded943
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/gx-workflow-ls-native/tests/testWorkflowProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ interface TestJsonWorkflows {
withoutWorkflowOutputLabels: string;
/** Workflow with 1 step. The step has 2 workflow_outputs with labels. */
withWorkflowOutputLabels: string;
/** Workflow with 6 steps. All steps are inputs with different types. */
withOnlyInputs: string;
};
}

Expand All @@ -33,6 +35,7 @@ export class TestWorkflowProvider {
path.join(TEST_DATA_PATH, "json", "validation", "test_wf_04.ga"),
"utf-8"
),
withOnlyInputs: fs.readFileSync(path.join(TEST_DATA_PATH, "json", "validation", "test_wf_05.ga"), "utf-8"),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ describe("NativeWorkflowDocument", () => {
TestWorkflowProvider.workflows.validation.withoutWorkflowOutputLabels,
[{ doc: "Step description", name: "Test Step", type: "data" }],
],
[
TestWorkflowProvider.workflows.validation.withOnlyInputs,
[
{ doc: "", name: "Dataset Input", type: "data" },
{ doc: "", name: "Collection Input", type: "collection" },
{ doc: "", name: "Text Param", type: "text" },
{ doc: "", name: "Integer Param", type: "integer" },
{ doc: "", name: "Float Param", type: "float" },
{ doc: "", name: "Boolean Param", type: "boolean" },
{ doc: "", name: "Color Param", type: "color" },
],
],
])("returns the expected inputs", (wfContent: string, expectedInputs: WorkflowInput[]) => {
const document = createNativeWorkflowDocument(wfContent);
const result = document.getWorkflowInputs();
Expand Down
201 changes: 201 additions & 0 deletions test-data/json/validation/test_wf_05.ga
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"a_galaxy_workflow": "true",
"annotation": "",
"comments": [],
"format-version": "0.1",
"name": "Workflow with inputs only",
"steps": {
"0": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 0,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Dataset Input"
}
],
"label": "Dataset Input",
"name": "Input dataset",
"outputs": [],
"position": {
"left": 21,
"top": 0
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"tag\": null}",
"tool_version": null,
"type": "data_input",
"uuid": "f38a0899-4d6a-42ef-a25e-fb860d624230",
"when": null,
"workflow_outputs": []
},
"1": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 1,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Collection Input"
}
],
"label": "Collection Input",
"name": "Input dataset collection",
"outputs": [],
"position": {
"left": 20,
"top": 123
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"tag\": null, \"collection_type\": \"list\"}",
"tool_version": null,
"type": "data_collection_input",
"uuid": "ee32048f-8e39-49cd-a2ff-cd24582a6bac",
"when": null,
"workflow_outputs": []
},
"2": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 2,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Text Param"
}
],
"label": "Text Param",
"name": "Input parameter",
"outputs": [],
"position": {
"left": 20,
"top": 260
},
"tool_id": null,
"tool_state": "{\"parameter_type\": \"text\", \"optional\": false}",
"tool_version": null,
"type": "parameter_input",
"uuid": "f15e91fb-b5f1-4a3d-910a-436e617afc53",
"when": null,
"workflow_outputs": []
},
"3": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 3,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Integer Param"
}
],
"label": "Integer Param",
"name": "Input parameter",
"outputs": [],
"position": {
"left": 24,
"top": 374
},
"tool_id": null,
"tool_state": "{\"parameter_type\": \"integer\", \"optional\": false}",
"tool_version": null,
"type": "parameter_input",
"uuid": "847d6938-c7aa-41fa-a139-611f4aaa900d",
"when": null,
"workflow_outputs": []
},
"4": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 4,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Float Param"
}
],
"label": "Float Param",
"name": "Input parameter",
"outputs": [],
"position": {
"left": 22,
"top": 489
},
"tool_id": null,
"tool_state": "{\"parameter_type\": \"float\", \"optional\": false}",
"tool_version": null,
"type": "parameter_input",
"uuid": "dd9fdf0e-76af-4de8-a1d8-e6a2f6265013",
"when": null,
"workflow_outputs": []
},
"5": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 5,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Boolean Param"
}
],
"label": "Boolean Param",
"name": "Input parameter",
"outputs": [],
"position": {
"left": 12,
"top": 596
},
"tool_id": null,
"tool_state": "{\"parameter_type\": \"boolean\", \"optional\": false}",
"tool_version": null,
"type": "parameter_input",
"uuid": "e600a8b4-3255-4f22-9452-71bde2b2a687",
"when": null,
"workflow_outputs": []
},
"6": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 6,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "Color Param"
}
],
"label": "Color Param",
"name": "Input parameter",
"outputs": [],
"position": {
"left": 0,
"top": 712
},
"tool_id": null,
"tool_state": "{\"parameter_type\": \"color\", \"optional\": false}",
"tool_version": null,
"type": "parameter_input",
"uuid": "28d79f2e-a8d0-49e1-aab3-a032b2d3d327",
"when": null,
"workflow_outputs": []
}
},
"tags": [],
"uuid": "a1d51848-2a7b-4ec1-b1a7-624e25d9c47a",
"version": 1
}

0 comments on commit 5ded943

Please sign in to comment.