forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseInvocation.test.js
More file actions
104 lines (100 loc) · 3.59 KB
/
parseInvocation.test.js
File metadata and controls
104 lines (100 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { describe, expect, it } from "vitest";
import { parseInvocation } from "./parseInvocation";
const INVOCATION = {
id: "invocation_id_1",
history_id: "history_id_1",
inputs: [
{
label: "input_1",
id: "input_id_1",
},
{
label: "input_2",
id: "input_id_2",
},
{
label: "input_3",
id: "input_id_3",
},
{
label: "input_collection_1",
id: "input_collection_id_1",
src: "hdca",
},
],
outputs: {
output_1: {
id: "output_id_1",
},
},
output_collections: {
output_2: {
id: "output_id_2",
},
},
steps: [
{
workflow_step_label: "workflow_step_1",
job_id: "job_id_1",
},
{
workflow_step_label: "workflow_step_2",
implicit_collection_jobs_id: "implicit_id_2",
job_id: "job_id_2",
},
],
};
const STORED_WORKFLOW_ID = "workflow_id_1";
describe("parseInvocation.ts", () => {
describe("parseInvocation", () => {
it("populate args with invocation details", () => {
expect(parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "history_link", {}).history_id).toBe("history_id_1");
expect(parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "workflow_display", {}).workflow_id).toBe(
"workflow_id_1",
);
expect(parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "workflow_image", {}).workflow_id).toBe(
"workflow_id_1",
);
expect(parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "workflow_license", {}).workflow_id).toBe(
"workflow_id_1",
);
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "history_dataset_display", {
input: "input_3",
}).history_dataset_id,
).toBe("input_id_3");
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "history_dataset_display", {
output: "unavailable_output",
}).history_dataset_id,
).toBeUndefined();
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "history_dataset_collection_display", {
output: "output_2",
}).history_dataset_collection_id,
).toBe("output_id_2");
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "", {
step: "workflow_step_1",
}).job_id,
).toBe("job_id_1");
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "", {
step: "workflow_step_2",
}).implicit_collection_jobs_id,
).toBe("implicit_id_2");
expect(parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "", {}).invocation.id).toBe("invocation_id_1");
// collection inputs (src=hdca) route to history_dataset_collection_id, not history_dataset_id
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "history_dataset_as_image", {
input: "input_collection_1",
}).history_dataset_collection_id,
).toBe("input_collection_id_1");
expect(
parseInvocation(INVOCATION, STORED_WORKFLOW_ID, "history_dataset_as_image", {
input: "input_collection_1",
}).history_dataset_id,
).toBeUndefined();
});
});
});