lhcb-ntuple-wizard-test 2.0.7 → 2.2.0
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/App.js +2 -1
- package/dist/components/AddTupleToolButton.d.ts +1 -0
- package/dist/components/AddTupleToolButton.js +16 -0
- package/dist/components/BookkeepingPathDropdown.d.ts +1 -1
- package/dist/components/BookkeepingPathDropdown.js +1 -4
- package/dist/components/DatasetEventTypeBadge.js +1 -1
- package/dist/components/DatasetInfo.js +3 -3
- package/dist/components/DecayCard.d.ts +1 -0
- package/dist/components/DecayCard.js +47 -0
- package/dist/components/DecayLatex.d.ts +1 -1
- package/dist/components/DecayLatex.js +4 -87
- package/dist/components/DecayListItem.js +2 -2
- package/dist/components/DecayTagBadge.d.ts +1 -1
- package/dist/components/DecayTagBadge.js +0 -3
- package/dist/components/DecayTreeCard.d.ts +1 -7
- package/dist/components/DecayTreeCard.js +14 -22
- package/dist/components/DecayTreeCardHeader.d.ts +2 -3
- package/dist/components/DecayTreeCardHeader.js +2 -2
- package/dist/components/DecayTreeGraph.d.ts +1 -5
- package/dist/components/DecayTreeGraph.js +160 -49
- package/dist/components/DeleteButton.d.ts +3 -1
- package/dist/components/DeleteButton.js +2 -2
- package/dist/components/DttNameInput.d.ts +9 -1
- package/dist/components/DttNameInput.js +29 -61
- package/dist/components/GuideLinkButton.d.ts +15 -0
- package/dist/components/GuideLinkButton.js +16 -0
- package/dist/components/NtupleWizard.js +1 -2
- package/dist/components/ParticleDropdown.d.ts +11 -1
- package/dist/components/ParticleDropdown.js +3 -6
- package/dist/components/ParticleLatex.d.ts +6 -0
- package/dist/components/ParticleLatex.js +13 -0
- package/dist/components/ParticleTagBadge.d.ts +2 -1
- package/dist/components/ParticleTagBadge.js +5 -7
- package/dist/components/ParticleTagFilters.d.ts +1 -6
- package/dist/components/ParticleTagFilters.js +16 -17
- package/dist/components/RequestButtonGroup.d.ts +1 -1
- package/dist/components/RequestButtonGroup.js +2 -5
- package/dist/components/RequestRow.d.ts +1 -1
- package/dist/components/RequestRow.js +8 -12
- package/dist/components/StrippingLineDropdown.js +14 -16
- package/dist/components/StrippingLineInfo.d.ts +5 -5
- package/dist/components/StrippingLineInfo.js +14 -4
- package/dist/components/StrippingLineInfoButton.d.ts +6 -0
- package/dist/components/StrippingLineInfoButton.js +7 -0
- package/dist/components/StrippingLineVersionBadge.d.ts +7 -0
- package/dist/components/{StrippingLineBadge.js → StrippingLineVersionBadge.js} +5 -5
- package/dist/components/StrippingLinesCountBadge.d.ts +8 -0
- package/dist/components/StrippingLinesCountBadge.js +11 -0
- package/dist/components/TagDropdown.d.ts +3 -3
- package/dist/components/TagDropdown.js +2 -2
- package/dist/components/{TupleToolDropdown.d.ts → TupleToolClassDropdown.d.ts} +2 -5
- package/dist/components/{TupleToolDropdown.js → TupleToolClassDropdown.js} +16 -13
- package/dist/components/TupleToolDocsAccordion.d.ts +1 -1
- package/dist/components/TupleToolDocsAccordion.js +4 -8
- package/dist/components/TupleToolGroupsAccordion.d.ts +5 -0
- package/dist/components/TupleToolGroupsAccordion.js +31 -0
- package/dist/components/TupleToolLabel.d.ts +1 -1
- package/dist/components/TupleToolLabel.js +2 -5
- package/dist/components/TupleToolsAccordion.d.ts +1 -0
- package/dist/components/TupleToolsAccordion.js +22 -0
- package/dist/components/VerticalLine.d.ts +7 -0
- package/dist/components/VerticalLine.js +4 -0
- package/dist/components/modals/AddTupleToolModal.d.ts +3 -4
- package/dist/components/modals/AddTupleToolModal.js +13 -12
- package/dist/components/modals/ConfigureTupleToolModal.d.ts +2 -2
- package/dist/components/modals/ConfigureTupleToolModal.js +28 -11
- package/dist/components/modals/UploadDttConfigModal.d.ts +1 -1
- package/dist/components/modals/UploadDttConfigModal.js +1 -4
- package/dist/config.d.ts +19 -47
- package/dist/config.js +27 -39
- package/dist/models/bkPath.js +1 -1
- package/dist/models/dtt.d.ts +5 -2
- package/dist/models/dtt.js +37 -18
- package/dist/models/rowData.d.ts +1 -1
- package/dist/models/yamlFile.js +1 -1
- package/dist/pages/DecaySearchPage.js +4 -9
- package/dist/pages/DecayTreeConfigPage.js +5 -39
- package/dist/pages/RequestPage.js +11 -16
- package/dist/providers/DttProvider.d.ts +5 -3
- package/dist/providers/DttProvider.js +33 -55
- package/dist/providers/MetadataProvider.d.ts +1 -1
- package/dist/providers/MetadataProvider.js +11 -5
- package/dist/providers/RequestProvider.js +2 -2
- package/dist/providers/RowProvider.d.ts +2 -2
- package/dist/providers/RowProvider.js +10 -9
- package/dist/providers/RowsProvider.js +0 -3
- package/dist/tests/components/BookkeepingPathDropdown.test.d.ts +1 -0
- package/dist/tests/components/BookkeepingPathDropdown.test.js +118 -0
- package/dist/tests/components/DatasetInfo.test.d.ts +1 -0
- package/dist/tests/components/DatasetInfo.test.js +38 -0
- package/dist/tests/components/DecayCard.test.d.ts +1 -0
- package/dist/tests/components/DecayCard.test.js +115 -0
- package/dist/tests/components/DecayLatex.test.d.ts +1 -0
- package/dist/tests/components/DecayLatex.test.js +31 -0
- package/dist/tests/components/DecayList.test.d.ts +1 -0
- package/dist/tests/components/DecayList.test.js +76 -0
- package/dist/tests/components/DecayListItem.test.d.ts +1 -0
- package/dist/tests/components/DecayListItem.test.js +51 -0
- package/dist/tests/components/DecayTreeCard.test.d.ts +1 -0
- package/dist/tests/components/DecayTreeCard.test.js +119 -0
- package/dist/tests/components/DecayTreeGraph.test.d.ts +1 -0
- package/dist/tests/components/DecayTreeGraph.test.js +125 -0
- package/dist/tests/components/DeleteButton.test.d.ts +1 -0
- package/dist/tests/components/DeleteButton.test.js +45 -0
- package/dist/tests/components/DttNameInput.test.d.ts +1 -0
- package/dist/tests/components/DttNameInput.test.js +75 -0
- package/dist/tests/components/NtupleWizard.test.d.ts +1 -0
- package/dist/tests/components/NtupleWizard.test.js +57 -0
- package/dist/tests/components/ParticleDropdown.test.d.ts +1 -0
- package/dist/tests/components/ParticleDropdown.test.js +23 -0
- package/dist/tests/components/ParticleTagFilters.test.d.ts +1 -0
- package/dist/tests/components/ParticleTagFilters.test.js +87 -0
- package/dist/tests/components/RequestButtonGroup.test.d.ts +1 -0
- package/dist/tests/components/RequestButtonGroup.test.js +132 -0
- package/dist/tests/components/RequestRow.test.d.ts +1 -0
- package/dist/tests/components/RequestRow.test.js +58 -0
- package/dist/tests/components/StrippingLineDropdown.test.d.ts +1 -0
- package/dist/tests/components/StrippingLineDropdown.test.js +88 -0
- package/dist/tests/components/badges.test.d.ts +1 -0
- package/dist/tests/components/badges.test.js +120 -0
- package/dist/tests/components/dropdowns.test.d.ts +1 -0
- package/dist/tests/components/dropdowns.test.js +110 -0
- package/dist/tests/components/dttComponents.test.d.ts +1 -0
- package/dist/tests/components/dttComponents.test.js +287 -0
- package/dist/tests/components/formInputs.test.d.ts +1 -0
- package/dist/tests/components/formInputs.test.js +96 -0
- package/dist/tests/components/metadataComponents.test.d.ts +1 -0
- package/dist/tests/components/metadataComponents.test.js +137 -0
- package/dist/tests/components/miscComponents.test.d.ts +1 -0
- package/dist/tests/components/miscComponents.test.js +134 -0
- package/dist/tests/components/modals.test.d.ts +1 -0
- package/dist/tests/components/modals.test.js +554 -0
- package/dist/tests/components/tupleToolParams.test.d.ts +1 -0
- package/dist/tests/components/tupleToolParams.test.js +213 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +31 -0
- package/dist/tests/mockSetup.d.ts +1 -0
- package/dist/tests/mockSetup.js +30 -0
- package/dist/tests/models/BkPath.test.d.ts +1 -0
- package/dist/tests/models/BkPath.test.js +87 -0
- package/dist/tests/models/Dtt.test.d.ts +1 -0
- package/dist/tests/models/Dtt.test.js +376 -0
- package/dist/tests/models/TupleTool.test.d.ts +1 -0
- package/dist/tests/models/TupleTool.test.js +80 -0
- package/dist/tests/models/YamlFile.test.d.ts +1 -0
- package/dist/tests/models/YamlFile.test.js +123 -0
- package/dist/tests/pages/DecaySearchPage.test.d.ts +1 -0
- package/dist/tests/pages/DecaySearchPage.test.js +228 -0
- package/dist/tests/pages/DecayTreeConfigPage.test.d.ts +1 -0
- package/dist/tests/pages/DecayTreeConfigPage.test.js +105 -0
- package/dist/tests/pages/RequestPage.test.d.ts +1 -0
- package/dist/tests/pages/RequestPage.test.js +439 -0
- package/dist/tests/providers/DttProvider.test.d.ts +1 -0
- package/dist/tests/providers/DttProvider.test.js +105 -0
- package/dist/tests/providers/MetadataProvider.test.d.ts +1 -0
- package/dist/tests/providers/MetadataProvider.test.js +129 -0
- package/dist/tests/providers/RequestProvider.test.d.ts +1 -0
- package/dist/tests/providers/RequestProvider.test.js +306 -0
- package/dist/tests/providers/RowProvider.test.d.ts +1 -0
- package/dist/tests/providers/RowProvider.test.js +110 -0
- package/dist/tests/providers/RowsProvider.test.d.ts +1 -0
- package/dist/tests/providers/RowsProvider.test.js +84 -0
- package/dist/tests/providers/WizardConfigProvider.test.d.ts +1 -0
- package/dist/tests/providers/WizardConfigProvider.test.js +36 -0
- package/dist/tests/setupTests.d.ts +1 -0
- package/dist/tests/setupTests.js +15 -0
- package/dist/tests/testUtils.d.ts +33 -0
- package/dist/tests/testUtils.js +196 -0
- package/dist/tests/utils/latexUtils.test.d.ts +1 -0
- package/dist/tests/utils/latexUtils.test.js +62 -0
- package/dist/tests/utils/utils.test.d.ts +1 -0
- package/dist/tests/utils/utils.test.js +394 -0
- package/dist/utils/latexUtils.d.ts +13 -0
- package/dist/utils/latexUtils.js +86 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +40 -4
- package/package.json +24 -10
- package/dist/components/NumStrippingLinesBadge.d.ts +0 -8
- package/dist/components/NumStrippingLinesBadge.js +0 -10
- package/dist/components/StrippingLineBadge.d.ts +0 -7
- package/dist/components/TupleToolGroup.d.ts +0 -6
- package/dist/components/TupleToolGroup.js +0 -22
- package/dist/components/TupleToolList.d.ts +0 -7
- package/dist/components/TupleToolList.js +0 -38
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import Dtt from "../../models/dtt";
|
|
3
|
+
import { TupleTool } from "../../models/tupleTool";
|
|
4
|
+
import { mockBranchItems, mockToolMetadata } from "../testUtils";
|
|
5
|
+
const DEFAULT_TOOLS = [
|
|
6
|
+
"TupleToolKinematic",
|
|
7
|
+
"TupleToolPid",
|
|
8
|
+
"TupleToolANNPID",
|
|
9
|
+
"TupleToolGeometry",
|
|
10
|
+
"TupleToolEventInfo",
|
|
11
|
+
];
|
|
12
|
+
function createDtt(name = "MyTree") {
|
|
13
|
+
return Dtt.create("[B+ -> ${head} ${k} ${mup} ${mum}]cc", mockBranchItems, [], name, mockToolMetadata);
|
|
14
|
+
}
|
|
15
|
+
describe("Dtt", () => {
|
|
16
|
+
describe("create()", () => {
|
|
17
|
+
it("creates a Dtt with all default tools", () => {
|
|
18
|
+
const dtt = createDtt();
|
|
19
|
+
for (const tool of DEFAULT_TOOLS) {
|
|
20
|
+
expect(dtt.toolExists(TupleTool.fromString(tool))).toBe(true);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
it("creates branches from the branch map", () => {
|
|
24
|
+
const dtt = createDtt();
|
|
25
|
+
expect(dtt.config.branches).toHaveProperty("head");
|
|
26
|
+
expect(dtt.config.branches).toHaveProperty("k");
|
|
27
|
+
expect(dtt.config.branches).toHaveProperty("mup");
|
|
28
|
+
expect(dtt.config.branches).toHaveProperty("mum");
|
|
29
|
+
});
|
|
30
|
+
it("assigns correct particle to each branch", () => {
|
|
31
|
+
const dtt = createDtt();
|
|
32
|
+
expect(dtt.config.branches["head"].particle).toBe("B+");
|
|
33
|
+
expect(dtt.config.branches["k"].particle).toBe("K+");
|
|
34
|
+
expect(dtt.config.branches["mup"].particle).toBe("mu+");
|
|
35
|
+
expect(dtt.config.branches["mum"].particle).toBe("mu-");
|
|
36
|
+
});
|
|
37
|
+
it("stores the descriptor template", () => {
|
|
38
|
+
const template = "[B+ -> ${head} ${k} ${mup} ${mum}]cc";
|
|
39
|
+
const dtt = Dtt.create(template, mockBranchItems, [], "MyTree", mockToolMetadata);
|
|
40
|
+
expect(dtt.config.descriptorTemplate).toBe(template);
|
|
41
|
+
});
|
|
42
|
+
it("sets input to first element when inputs list is non-empty", () => {
|
|
43
|
+
const input = "/Event/Phys/TestLine/Particles";
|
|
44
|
+
const dtt = Dtt.create("t", mockBranchItems, [input], "MyTree", mockToolMetadata);
|
|
45
|
+
expect(dtt.config.input).toBe(input);
|
|
46
|
+
});
|
|
47
|
+
it("leaves input undefined when inputs list is empty", () => {
|
|
48
|
+
const dtt = createDtt();
|
|
49
|
+
expect(dtt.config.input).toBeUndefined();
|
|
50
|
+
});
|
|
51
|
+
it("initializes with empty groups", () => {
|
|
52
|
+
const dtt = createDtt();
|
|
53
|
+
expect(dtt.config.groups).toEqual({});
|
|
54
|
+
});
|
|
55
|
+
it("applies default tool params from metadata", () => {
|
|
56
|
+
const dtt = createDtt();
|
|
57
|
+
expect(dtt.config.tools["TupleToolKinematic"]["Verbose"].value).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("withAddedTool()", () => {
|
|
61
|
+
it("adds a tool to global tools", () => {
|
|
62
|
+
const dtt = createDtt();
|
|
63
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
64
|
+
const updated = dtt.withAddedTool(newTool);
|
|
65
|
+
expect(updated.toolExists(newTool)).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
it("is immutable — original not modified", () => {
|
|
68
|
+
const dtt = createDtt();
|
|
69
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
70
|
+
dtt.withAddedTool(newTool);
|
|
71
|
+
expect(dtt.toolExists(newTool)).toBe(false);
|
|
72
|
+
});
|
|
73
|
+
it("returns same instance when tool already exists", () => {
|
|
74
|
+
const dtt = createDtt();
|
|
75
|
+
const existingTool = TupleTool.fromString("TupleToolKinematic");
|
|
76
|
+
const updated = dtt.withAddedTool(existingTool);
|
|
77
|
+
expect(updated).toBe(dtt);
|
|
78
|
+
});
|
|
79
|
+
it("adds tool to a specific branch", () => {
|
|
80
|
+
const dtt = createDtt();
|
|
81
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
82
|
+
const updated = dtt.withAddedTool(newTool, ["head"]);
|
|
83
|
+
expect(updated.toolExists(newTool, ["head"])).toBe(true);
|
|
84
|
+
// global tools should not be affected
|
|
85
|
+
expect(updated.toolExists(newTool)).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
it("adds tool to a group when multiple branches specified", () => {
|
|
88
|
+
const dtt = createDtt();
|
|
89
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
90
|
+
const updated = dtt.withAddedTool(newTool, ["head", "k"]);
|
|
91
|
+
expect(updated.toolExists(newTool, ["head", "k"])).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
it("creates group with correct particles", () => {
|
|
94
|
+
const dtt = createDtt();
|
|
95
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
96
|
+
const updated = dtt.withAddedTool(newTool, ["head", "k"]);
|
|
97
|
+
const particles = updated.getParticlesByBranchId(["head", "k"]);
|
|
98
|
+
expect(particles).toContain("B+");
|
|
99
|
+
expect(particles).toContain("K+");
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
describe("withRemovedTool()", () => {
|
|
103
|
+
it("removes a tool from global tools", () => {
|
|
104
|
+
const dtt = createDtt();
|
|
105
|
+
const tool = TupleTool.fromString("TupleToolKinematic");
|
|
106
|
+
const updated = dtt.withRemovedTool(tool);
|
|
107
|
+
expect(updated.toolExists(tool)).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
it("is immutable — original not modified", () => {
|
|
110
|
+
const dtt = createDtt();
|
|
111
|
+
const tool = TupleTool.fromString("TupleToolKinematic");
|
|
112
|
+
dtt.withRemovedTool(tool);
|
|
113
|
+
expect(dtt.toolExists(tool)).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
it("removes tool from a specific branch", () => {
|
|
116
|
+
const dtt = createDtt();
|
|
117
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
118
|
+
const withTool = dtt.withAddedTool(newTool, ["head"]);
|
|
119
|
+
const withoutTool = withTool.withRemovedTool(newTool, ["head"]);
|
|
120
|
+
expect(withoutTool.toolExists(newTool, ["head"])).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
it("only removes from the specified branch, not global", () => {
|
|
123
|
+
const dtt = createDtt();
|
|
124
|
+
const tool = TupleTool.fromString("TupleToolKinematic");
|
|
125
|
+
const updated = dtt.withRemovedTool(tool, ["head"]);
|
|
126
|
+
// Global tools should still contain it
|
|
127
|
+
expect(updated.toolExists(tool)).toBe(true);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
describe("withUpdatedToolParam()", () => {
|
|
131
|
+
it("updates a bool parameter value", () => {
|
|
132
|
+
const dtt = createDtt();
|
|
133
|
+
const tool = TupleTool.fromString("TupleToolKinematic");
|
|
134
|
+
const updated = dtt.withUpdatedToolParam([], tool, "Verbose", true);
|
|
135
|
+
expect(updated.config.tools["TupleToolKinematic"]["Verbose"].value).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it("is immutable — original not modified", () => {
|
|
138
|
+
const dtt = createDtt();
|
|
139
|
+
const tool = TupleTool.fromString("TupleToolKinematic");
|
|
140
|
+
dtt.withUpdatedToolParam([], tool, "Verbose", true);
|
|
141
|
+
expect(dtt.config.tools["TupleToolKinematic"]["Verbose"].value).toBe(false);
|
|
142
|
+
});
|
|
143
|
+
it("preserves other params when updating one", () => {
|
|
144
|
+
const dtt = createDtt();
|
|
145
|
+
const tool = TupleTool.fromString("TupleToolPid");
|
|
146
|
+
const updated = dtt.withUpdatedToolParam([], tool, "Verbose", true);
|
|
147
|
+
// TupleToolKinematic should still have default Verbose
|
|
148
|
+
expect(updated.config.tools["TupleToolKinematic"]["Verbose"].value).toBe(false);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
describe("withName()", () => {
|
|
152
|
+
it("sets name with DecayTreeTuple/ prefix", () => {
|
|
153
|
+
const dtt = createDtt();
|
|
154
|
+
const updated = dtt.withName("MyDecayTree");
|
|
155
|
+
expect(updated.config.name).toBe("DecayTreeTuple/MyDecayTree");
|
|
156
|
+
});
|
|
157
|
+
it("strips non-word characters from name", () => {
|
|
158
|
+
const dtt = createDtt();
|
|
159
|
+
const updated = dtt.withName("My Decay-Tree!");
|
|
160
|
+
expect(updated.config.name).toBe("DecayTreeTuple/MyDecayTree");
|
|
161
|
+
});
|
|
162
|
+
it("is immutable — original not modified", () => {
|
|
163
|
+
const dtt = createDtt();
|
|
164
|
+
const originalName = dtt.config.name;
|
|
165
|
+
dtt.withName("NewName");
|
|
166
|
+
expect(dtt.config.name).toBe(originalName);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe("withInputFromLine()", () => {
|
|
170
|
+
it("constructs the correct input path from a stripping line", () => {
|
|
171
|
+
const dtt = createDtt();
|
|
172
|
+
const line = {
|
|
173
|
+
line: "StrippingBuToKJpsiee2Line",
|
|
174
|
+
stream: "Leptonic",
|
|
175
|
+
versions: ["28r2"],
|
|
176
|
+
};
|
|
177
|
+
const updated = dtt.withInputFromLine(line);
|
|
178
|
+
expect(updated.config.input).toBe("/Event/Leptonic/Phys/BuToKJpsiee2Line/Particles");
|
|
179
|
+
});
|
|
180
|
+
it("is immutable — original not modified", () => {
|
|
181
|
+
const dtt = createDtt();
|
|
182
|
+
const line = { line: "StrippingTestLine", stream: "Charm", versions: [] };
|
|
183
|
+
dtt.withInputFromLine(line);
|
|
184
|
+
expect(dtt.config.input).toBeUndefined();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
describe("getName()", () => {
|
|
188
|
+
it("returns the part after '/' in the name", () => {
|
|
189
|
+
const dtt = createDtt().withName("MyTree");
|
|
190
|
+
expect(dtt.getName()).toBe("MyTree");
|
|
191
|
+
});
|
|
192
|
+
it("returns empty string when name is not set", () => {
|
|
193
|
+
const dtt = new Dtt({ tools: {}, branches: {}, groups: {} }, mockToolMetadata);
|
|
194
|
+
expect(dtt.getName()).toBe("");
|
|
195
|
+
});
|
|
196
|
+
it("returns the whole name if no slash present", () => {
|
|
197
|
+
const dtt = new Dtt({ tools: {}, branches: {}, groups: {}, name: "MyTree" }, mockToolMetadata);
|
|
198
|
+
expect(dtt.getName()).toBe("MyTree");
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
describe("listTools()", () => {
|
|
202
|
+
it("returns a TupleTool instance for each global tool", () => {
|
|
203
|
+
const dtt = createDtt();
|
|
204
|
+
const tools = dtt.listTools();
|
|
205
|
+
expect(tools).toHaveLength(DEFAULT_TOOLS.length);
|
|
206
|
+
tools.forEach((t) => expect(t).toBeInstanceOf(TupleTool));
|
|
207
|
+
});
|
|
208
|
+
it("returns empty array when DTT has no tools", () => {
|
|
209
|
+
const dtt = new Dtt({ tools: {}, branches: {}, groups: {} }, mockToolMetadata);
|
|
210
|
+
expect(dtt.listTools()).toEqual([]);
|
|
211
|
+
});
|
|
212
|
+
it("returns branch-specific tools when branch is specified", () => {
|
|
213
|
+
const dtt = createDtt();
|
|
214
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
215
|
+
const updated = dtt.withAddedTool(newTool, ["head"]);
|
|
216
|
+
const branchTools = updated.listTools(["head"]);
|
|
217
|
+
expect(branchTools.some((t) => t.equals(newTool))).toBe(true);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
describe("toolExists()", () => {
|
|
221
|
+
it("returns true for an existing global tool", () => {
|
|
222
|
+
const dtt = createDtt();
|
|
223
|
+
expect(dtt.toolExists(TupleTool.fromString("TupleToolKinematic"))).toBe(true);
|
|
224
|
+
});
|
|
225
|
+
it("returns false for a non-existing tool", () => {
|
|
226
|
+
const dtt = createDtt();
|
|
227
|
+
expect(dtt.toolExists(TupleTool.fromString("TupleToolL0Data"))).toBe(false);
|
|
228
|
+
});
|
|
229
|
+
it("returns true for a branch tool in the correct branch", () => {
|
|
230
|
+
const dtt = createDtt();
|
|
231
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
232
|
+
const updated = dtt.withAddedTool(newTool, ["head"]);
|
|
233
|
+
expect(updated.toolExists(newTool, ["head"])).toBe(true);
|
|
234
|
+
});
|
|
235
|
+
it("returns false for a branch tool checked in the wrong branch", () => {
|
|
236
|
+
const dtt = createDtt();
|
|
237
|
+
const newTool = new TupleTool("TupleToolL0Data", "");
|
|
238
|
+
const updated = dtt.withAddedTool(newTool, ["head"]);
|
|
239
|
+
expect(updated.toolExists(newTool, ["k"])).toBe(false);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
describe("getGroupsWithTools()", () => {
|
|
243
|
+
it("returns empty array when no groups have tools", () => {
|
|
244
|
+
const dtt = createDtt();
|
|
245
|
+
expect(dtt.getGroupsWithTools()).toEqual([]);
|
|
246
|
+
});
|
|
247
|
+
it("returns the group key when a group has tools", () => {
|
|
248
|
+
const dtt = createDtt();
|
|
249
|
+
const tool = new TupleTool("TupleToolL0Data", "");
|
|
250
|
+
const updated = dtt.withAddedTool(tool, ["head", "k"]);
|
|
251
|
+
expect(updated.getGroupsWithTools()).toContain("head,k");
|
|
252
|
+
});
|
|
253
|
+
it("does not return empty groups", () => {
|
|
254
|
+
const dtt = createDtt();
|
|
255
|
+
// Touch a group (creates it empty) then check
|
|
256
|
+
dtt.getParticlesByBranchId(["head", "k"]);
|
|
257
|
+
expect(dtt.getGroupsWithTools()).toEqual([]);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
describe("getGroupsThatIncludeBranch()", () => {
|
|
261
|
+
it("returns groups containing the specified branch", () => {
|
|
262
|
+
const dtt = createDtt();
|
|
263
|
+
const tool = new TupleTool("TupleToolL0Data", "");
|
|
264
|
+
const updated = dtt.withAddedTool(tool, ["head", "k"]);
|
|
265
|
+
expect(updated.getGroupsThatIncludeBranch(["head"])).toContain("head,k");
|
|
266
|
+
});
|
|
267
|
+
it("returns empty when no groups contain the specified branch", () => {
|
|
268
|
+
const dtt = createDtt();
|
|
269
|
+
expect(dtt.getGroupsThatIncludeBranch(["head"])).toEqual([]);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
describe("toSavedConfig() / fromSavedConfig() roundtrip", () => {
|
|
273
|
+
it("skips unknown params when loading tool config", () => {
|
|
274
|
+
const dtt = createDtt();
|
|
275
|
+
const saved = dtt.toSavedConfig();
|
|
276
|
+
// Add a param that doesn't exist in TupleToolKinematic's interface
|
|
277
|
+
const kinemEntry = saved.tools.find((t) => "TupleToolKinematic" in t);
|
|
278
|
+
kinemEntry["TupleToolKinematic"]["UnknownParam"] = true;
|
|
279
|
+
const loaded = Dtt.fromSavedConfig(saved, mockToolMetadata);
|
|
280
|
+
expect(loaded.toolExists(TupleTool.fromString("TupleToolKinematic"))).toBe(true);
|
|
281
|
+
expect(loaded.config.tools["TupleToolKinematic"]["UnknownParam"]).toBeUndefined();
|
|
282
|
+
});
|
|
283
|
+
it("preserves groups after roundtrip through fromSavedConfig", () => {
|
|
284
|
+
const dtt = createDtt().withAddedTool(new TupleTool("TupleToolL0Data", ""), ["head", "k"]);
|
|
285
|
+
const saved = dtt.toSavedConfig();
|
|
286
|
+
const loaded = Dtt.fromSavedConfig(saved, mockToolMetadata);
|
|
287
|
+
expect(loaded.toolExists(new TupleTool("TupleToolL0Data", ""), ["head", "k"])).toBe(true);
|
|
288
|
+
});
|
|
289
|
+
it("preserves the descriptor template", () => {
|
|
290
|
+
const template = "[B+ -> ${head} ${k} ${mup} ${mum}]cc";
|
|
291
|
+
const dtt = Dtt.create(template, mockBranchItems, [], "MyTree", mockToolMetadata);
|
|
292
|
+
const saved = dtt.toSavedConfig();
|
|
293
|
+
expect(saved.descriptorTemplate).toBe(template);
|
|
294
|
+
});
|
|
295
|
+
it("saves tool params as plain values, not ToolParam objects", () => {
|
|
296
|
+
const dtt = createDtt().withUpdatedToolParam([], TupleTool.fromString("TupleToolKinematic"), "Verbose", true);
|
|
297
|
+
const saved = dtt.toSavedConfig();
|
|
298
|
+
const kinemEntry = saved.tools.find((t) => "TupleToolKinematic" in t);
|
|
299
|
+
expect(kinemEntry?.["TupleToolKinematic"]?.["Verbose"]).toBe(true);
|
|
300
|
+
});
|
|
301
|
+
it("reconstructs global tools after roundtrip", () => {
|
|
302
|
+
const dtt = createDtt();
|
|
303
|
+
const saved = dtt.toSavedConfig();
|
|
304
|
+
const loaded = Dtt.fromSavedConfig(saved, mockToolMetadata);
|
|
305
|
+
for (const toolName of DEFAULT_TOOLS) {
|
|
306
|
+
expect(loaded.toolExists(TupleTool.fromString(toolName))).toBe(true);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
it("preserves branch particle assignments after roundtrip", () => {
|
|
310
|
+
const dtt = createDtt();
|
|
311
|
+
const saved = dtt.toSavedConfig();
|
|
312
|
+
const loaded = Dtt.fromSavedConfig(saved, mockToolMetadata);
|
|
313
|
+
expect(loaded.config.branches["head"].particle).toBe("B+");
|
|
314
|
+
expect(loaded.config.branches["k"].particle).toBe("K+");
|
|
315
|
+
});
|
|
316
|
+
it("skips tools not found in metadata during load", () => {
|
|
317
|
+
const dtt = createDtt();
|
|
318
|
+
const saved = dtt.toSavedConfig();
|
|
319
|
+
// Add an unknown tool entry to the saved config
|
|
320
|
+
saved.tools.push({ UnknownTool: { SomeParam: true } });
|
|
321
|
+
const loaded = Dtt.fromSavedConfig(saved, mockToolMetadata);
|
|
322
|
+
expect(loaded.toolExists(TupleTool.fromString("UnknownTool"))).toBe(false);
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
describe("withConfig()", () => {
|
|
326
|
+
it("returns a new Dtt with the supplied config", () => {
|
|
327
|
+
const dtt = createDtt();
|
|
328
|
+
const newConfig = { ...dtt.config, name: "DecayTreeTuple/NewName" };
|
|
329
|
+
const newDtt = dtt.withConfig(newConfig);
|
|
330
|
+
expect(newDtt.getName()).toBe("NewName");
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
describe("toSavedConfig() with groups", () => {
|
|
334
|
+
it("includes group tools in the saved config", () => {
|
|
335
|
+
const dtt = createDtt().withAddedTool(new TupleTool("TupleToolKinematic", ""), ["head", "k"]);
|
|
336
|
+
const saved = dtt.toSavedConfig();
|
|
337
|
+
const groupKey = "head,k";
|
|
338
|
+
expect(saved.groups).toHaveProperty(groupKey);
|
|
339
|
+
expect(saved.groups[groupKey].tools).toHaveLength(1);
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
describe("pruneGroups()", () => {
|
|
343
|
+
it("removes groups that have no tools", () => {
|
|
344
|
+
const dtt = createDtt();
|
|
345
|
+
// Add a group then remove the tool from it
|
|
346
|
+
const withGroup = dtt.withAddedTool(new TupleTool("TupleToolKinematic", ""), ["head", "k"]);
|
|
347
|
+
const withRemovedTool = withGroup.withRemovedTool(new TupleTool("TupleToolKinematic", ""), ["head", "k"]);
|
|
348
|
+
// After pruning (triggered by getToolsByBranch), the group should be gone
|
|
349
|
+
const tools = withRemovedTool.getToolsByBranch(["head", "k"]);
|
|
350
|
+
expect(Object.keys(tools)).toHaveLength(0);
|
|
351
|
+
});
|
|
352
|
+
it("keeps groups that still have tools", () => {
|
|
353
|
+
const dtt = createDtt();
|
|
354
|
+
const withGroup = dtt.withAddedTool(new TupleTool("TupleToolKinematic", ""), ["head", "k"]);
|
|
355
|
+
const tools = withGroup.getToolsByBranch(["head", "k"]);
|
|
356
|
+
expect("TupleToolKinematic").toEqual(Object.keys(tools)[0]);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
describe("getBranchTools()", () => {
|
|
360
|
+
it("returns tool names for global branch (no branch arg)", () => {
|
|
361
|
+
const dtt = createDtt();
|
|
362
|
+
const tools = dtt.getBranchTools();
|
|
363
|
+
expect(tools).toContain("TupleToolKinematic");
|
|
364
|
+
});
|
|
365
|
+
it("returns tool names for a specific branch", () => {
|
|
366
|
+
const dtt = createDtt().withAddedTool(new TupleTool("TupleToolL0Data", ""), ["head"]);
|
|
367
|
+
const tools = dtt.getBranchTools(["head"]);
|
|
368
|
+
expect(tools).toContain("TupleToolL0Data");
|
|
369
|
+
});
|
|
370
|
+
it("returns an empty array for a group with no tools", () => {
|
|
371
|
+
const dtt = createDtt();
|
|
372
|
+
const tools = dtt.getBranchTools(["head", "k"]);
|
|
373
|
+
expect(tools).toHaveLength(0);
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { TupleTool } from "../../models/tupleTool";
|
|
3
|
+
describe("TupleTool", () => {
|
|
4
|
+
describe("constructor", () => {
|
|
5
|
+
it("stores class and name", () => {
|
|
6
|
+
const tool = new TupleTool("TupleToolKinematic", "myKinematic");
|
|
7
|
+
expect(tool.class).toBe("TupleToolKinematic");
|
|
8
|
+
expect(tool.name).toBe("myKinematic");
|
|
9
|
+
});
|
|
10
|
+
it("stores class with empty name", () => {
|
|
11
|
+
const tool = new TupleTool("TupleToolKinematic", "");
|
|
12
|
+
expect(tool.class).toBe("TupleToolKinematic");
|
|
13
|
+
expect(tool.name).toBe("");
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
describe("toString()", () => {
|
|
17
|
+
it("returns 'Class/name' when name is set", () => {
|
|
18
|
+
const tool = new TupleTool("TupleToolKinematic", "myKinematic");
|
|
19
|
+
expect(tool.toString()).toBe("TupleToolKinematic/myKinematic");
|
|
20
|
+
});
|
|
21
|
+
it("returns just class when name is empty", () => {
|
|
22
|
+
const tool = new TupleTool("TupleToolKinematic", "");
|
|
23
|
+
expect(tool.toString()).toBe("TupleToolKinematic");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe("fromString()", () => {
|
|
27
|
+
it("parses 'Class/name' string", () => {
|
|
28
|
+
const tool = TupleTool.fromString("TupleToolKinematic/myKinematic");
|
|
29
|
+
expect(tool.class).toBe("TupleToolKinematic");
|
|
30
|
+
expect(tool.name).toBe("myKinematic");
|
|
31
|
+
});
|
|
32
|
+
it("parses class-only string", () => {
|
|
33
|
+
const tool = TupleTool.fromString("TupleToolKinematic");
|
|
34
|
+
expect(tool.class).toBe("TupleToolKinematic");
|
|
35
|
+
expect(tool.name).toBe("");
|
|
36
|
+
});
|
|
37
|
+
it("handles class with nested slashes (only splits on first slash)", () => {
|
|
38
|
+
const tool = TupleTool.fromString("LoKi__Hybrid__TupleTool/myLoki");
|
|
39
|
+
expect(tool.class).toBe("LoKi__Hybrid__TupleTool");
|
|
40
|
+
expect(tool.name).toBe("myLoki");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe("equals()", () => {
|
|
44
|
+
it("returns true for identical tools with name", () => {
|
|
45
|
+
const a = new TupleTool("TupleToolKinematic", "myKinematic");
|
|
46
|
+
const b = new TupleTool("TupleToolKinematic", "myKinematic");
|
|
47
|
+
expect(a.equals(b)).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
it("returns true for identical tools without name", () => {
|
|
50
|
+
const a = new TupleTool("TupleToolKinematic", "");
|
|
51
|
+
const b = new TupleTool("TupleToolKinematic", "");
|
|
52
|
+
expect(a.equals(b)).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it("returns false for different class", () => {
|
|
55
|
+
const a = new TupleTool("TupleToolKinematic", "");
|
|
56
|
+
const b = new TupleTool("TupleToolPid", "");
|
|
57
|
+
expect(a.equals(b)).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
it("returns false for different name", () => {
|
|
60
|
+
const a = new TupleTool("TupleToolKinematic", "myKinematic");
|
|
61
|
+
const b = new TupleTool("TupleToolKinematic", "otherKinematic");
|
|
62
|
+
expect(a.equals(b)).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
it("returns false when one has name and other does not", () => {
|
|
65
|
+
const a = new TupleTool("TupleToolKinematic", "myKinematic");
|
|
66
|
+
const b = new TupleTool("TupleToolKinematic", "");
|
|
67
|
+
expect(a.equals(b)).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe("fromString / toString roundtrip", () => {
|
|
71
|
+
it("round-trips a tool with name", () => {
|
|
72
|
+
const original = "TupleToolL0Data/myL0Data";
|
|
73
|
+
expect(TupleTool.fromString(original).toString()).toBe(original);
|
|
74
|
+
});
|
|
75
|
+
it("round-trips a tool without name", () => {
|
|
76
|
+
const original = "TupleToolGeometry";
|
|
77
|
+
expect(TupleTool.fromString(original).toString()).toBe(original);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { YamlFile } from "../../models/yamlFile";
|
|
3
|
+
import Dtt from "../../models/dtt";
|
|
4
|
+
import yaml from "js-yaml";
|
|
5
|
+
import { createMockRow, mockBranchItems, mockDecay, mockMetadata, mockStrippingLine, mockToolMetadata, } from "../testUtils";
|
|
6
|
+
function createNamedDtt(name) {
|
|
7
|
+
return Dtt.create("[B+ -> ${head} ${k} ${mup} ${mum}]cc", mockBranchItems, [], name, mockToolMetadata).withName(name);
|
|
8
|
+
}
|
|
9
|
+
describe("YamlFile", () => {
|
|
10
|
+
describe("constructor", () => {
|
|
11
|
+
it("sanitizes the filename", () => {
|
|
12
|
+
const file = new YamlFile("../unsafe/../file.yaml", "content");
|
|
13
|
+
// Path traversal characters are removed
|
|
14
|
+
expect(file.name).not.toContain("..");
|
|
15
|
+
expect(file.name).not.toContain("/");
|
|
16
|
+
});
|
|
17
|
+
it("stores the content unchanged", () => {
|
|
18
|
+
const content = "tools:\n - TupleToolKinematic\n";
|
|
19
|
+
const file = new YamlFile("test.yaml", content);
|
|
20
|
+
expect(file.content).toBe(content);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe("fromDtt()", () => {
|
|
24
|
+
it("uses the DTT name as the filename", () => {
|
|
25
|
+
const dtt = createNamedDtt("MyTree");
|
|
26
|
+
const file = YamlFile.fromDtt(dtt);
|
|
27
|
+
expect(file.name).toBe("MyTree.yaml");
|
|
28
|
+
});
|
|
29
|
+
it("produces valid YAML content", () => {
|
|
30
|
+
const dtt = createNamedDtt("MyTree");
|
|
31
|
+
const file = YamlFile.fromDtt(dtt);
|
|
32
|
+
expect(() => yaml.load(file.content)).not.toThrow();
|
|
33
|
+
});
|
|
34
|
+
it("YAML content contains the descriptor template", () => {
|
|
35
|
+
const template = "[B+ -> ${head} ${k} ${mup} ${mum}]cc";
|
|
36
|
+
const dtt = Dtt.create(template, mockBranchItems, [], "MyTree", mockToolMetadata).withName("MyTree");
|
|
37
|
+
const file = YamlFile.fromDtt(dtt);
|
|
38
|
+
const parsed = yaml.load(file.content);
|
|
39
|
+
expect(parsed.descriptorTemplate).toBe(template);
|
|
40
|
+
});
|
|
41
|
+
it("YAML content lists the default tools", () => {
|
|
42
|
+
const dtt = createNamedDtt("MyTree");
|
|
43
|
+
const file = YamlFile.fromDtt(dtt);
|
|
44
|
+
const parsed = yaml.load(file.content);
|
|
45
|
+
const toolNames = (parsed.tools ?? []).map((t) => Object.keys(t)[0]);
|
|
46
|
+
expect(toolNames).toContain("TupleToolKinematic");
|
|
47
|
+
expect(toolNames).toContain("TupleToolPid");
|
|
48
|
+
});
|
|
49
|
+
it("YAML content includes branch definitions", () => {
|
|
50
|
+
const dtt = createNamedDtt("MyTree");
|
|
51
|
+
const file = YamlFile.fromDtt(dtt);
|
|
52
|
+
const parsed = yaml.load(file.content);
|
|
53
|
+
expect(parsed.branches).toHaveProperty("head");
|
|
54
|
+
expect(parsed.branches).toHaveProperty("k");
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe("createInfoYaml()", () => {
|
|
58
|
+
const VALID_PATH = "/LHCb/Collision16/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco16/Stripping28r2/90000000/DIMUON.DST";
|
|
59
|
+
function createRowWithPath(id, name, paths) {
|
|
60
|
+
return createMockRow({
|
|
61
|
+
id,
|
|
62
|
+
decay: mockDecay,
|
|
63
|
+
dtt: createNamedDtt(name),
|
|
64
|
+
line: mockStrippingLine,
|
|
65
|
+
paths,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
it("produces a file named 'info.yaml'", () => {
|
|
69
|
+
const file = YamlFile.createInfoYaml([], mockMetadata);
|
|
70
|
+
expect(file.name).toBe("info.yaml");
|
|
71
|
+
});
|
|
72
|
+
it("includes the DaVinci application version in defaults", () => {
|
|
73
|
+
const file = YamlFile.createInfoYaml([], mockMetadata);
|
|
74
|
+
const parsed = yaml.load(file.content);
|
|
75
|
+
expect(parsed.defaults?.application).toContain("DaVinci");
|
|
76
|
+
expect(parsed.defaults?.application).toContain("v45r7");
|
|
77
|
+
});
|
|
78
|
+
it("includes standard defaults", () => {
|
|
79
|
+
const file = YamlFile.createInfoYaml([], mockMetadata);
|
|
80
|
+
const parsed = yaml.load(file.content);
|
|
81
|
+
expect(parsed.defaults?.wg).toBe("OpenData");
|
|
82
|
+
expect(parsed.defaults?.automatically_configure).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
it("creates a job entry for each unique path", () => {
|
|
85
|
+
const row = createRowWithPath(0, "MyTree", [VALID_PATH]);
|
|
86
|
+
const file = YamlFile.createInfoYaml([row], mockMetadata);
|
|
87
|
+
const parsed = yaml.load(file.content);
|
|
88
|
+
expect(parsed.job0?.input?.bk_query).toBe(VALID_PATH);
|
|
89
|
+
});
|
|
90
|
+
it("includes the DTT filename in the job options", () => {
|
|
91
|
+
const row = createRowWithPath(0, "MyTree", [VALID_PATH]);
|
|
92
|
+
const file = YamlFile.createInfoYaml([row], mockMetadata);
|
|
93
|
+
const parsed = yaml.load(file.content);
|
|
94
|
+
expect(parsed.job0?.options).toContain("MyTree");
|
|
95
|
+
});
|
|
96
|
+
it("skips rows without a DTT", () => {
|
|
97
|
+
const row = createMockRow({ id: 0, paths: [VALID_PATH], dtt: null });
|
|
98
|
+
const file = YamlFile.createInfoYaml([row], mockMetadata);
|
|
99
|
+
const parsed = yaml.load(file.content);
|
|
100
|
+
expect(Object.keys(parsed)).not.toContain("job0");
|
|
101
|
+
});
|
|
102
|
+
it("merges multiple DTTs for the same path into one job", () => {
|
|
103
|
+
const row1 = createRowWithPath(0, "TreeA", [VALID_PATH]);
|
|
104
|
+
const row2 = createRowWithPath(1, "TreeB", [VALID_PATH]);
|
|
105
|
+
const file = YamlFile.createInfoYaml([row1, row2], mockMetadata);
|
|
106
|
+
const parsed = yaml.load(file.content);
|
|
107
|
+
expect(parsed.job0?.options).toHaveLength(2);
|
|
108
|
+
});
|
|
109
|
+
it("adds root_in_tes for MDST paths", () => {
|
|
110
|
+
const mdstPath = "/LHCb/Collision16/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco16/Stripping28r2/90000000/DIMUON.MDST";
|
|
111
|
+
const row = createRowWithPath(0, "MyTree", [mdstPath]);
|
|
112
|
+
const file = YamlFile.createInfoYaml([row], mockMetadata);
|
|
113
|
+
const parsed = yaml.load(file.content);
|
|
114
|
+
expect(parsed.job0?.root_in_tes).toContain("Leptonic");
|
|
115
|
+
});
|
|
116
|
+
it("does not add root_in_tes for non-MDST paths", () => {
|
|
117
|
+
const row = createRowWithPath(0, "MyTree", [VALID_PATH]);
|
|
118
|
+
const file = YamlFile.createInfoYaml([row], mockMetadata);
|
|
119
|
+
const parsed = yaml.load(file.content);
|
|
120
|
+
expect(parsed.job0?.root_in_tes).toBeUndefined();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|