Skip to content

Commit 54cd7a1

Browse files
committed
[O2B-1505] tests added/improv
1 parent d93b0f6 commit 54cd7a1

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

test/lib/usecases/lhcFill/GetAllLhcFillsUseCase.test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,55 @@ module.exports = () => {
100100
expect(lhcFill.fillNumber).oneOf([6,3])
101101
});
102102
})
103+
104+
// Beam duration filter tests
105+
106+
it('should only contain specified stable beam durations, < 12:00:00', async () => {
107+
getAllLhcFillsDto.query = { filter: { beamDuration: '43200', beamDurationOperator: '<', hasStableBeams: true } };
108+
const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto);
109+
expect(lhcFills).to.be.an('array').and.lengthOf(3)
110+
lhcFills.forEach((lhcFill) => {
111+
expect(lhcFill.stableBeamsDuration).lessThan(43200)
112+
});
113+
});
114+
115+
it('should only contain specified stable beam durations, <= 12:00:00', async () => {
116+
getAllLhcFillsDto.query = { filter: { beamDuration: '43200', beamDurationOperator: '<=', hasStableBeams: true } };
117+
const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto)
118+
expect(lhcFills).to.be.an('array').and.lengthOf(4)
119+
lhcFills.forEach((lhcFill) => {
120+
expect(lhcFill.stableBeamsDuration).lessThanOrEqual(43200)
121+
});
122+
})
123+
124+
it('should only contain specified stable beam durations, = 00:01:40', async () => {
125+
getAllLhcFillsDto.query = { filter: { beamDuration: '100', beamDurationOperator: '=', hasStableBeams: true } };
126+
const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto)
127+
expect(lhcFills).to.be.an('array').and.lengthOf(2)
128+
lhcFills.forEach((lhcFill) => {
129+
expect(lhcFill.stableBeamsDuration).equal(100)
130+
});
131+
});
132+
133+
it('should only contain specified stable beam durations, >= 00:01:40', async () => {
134+
getAllLhcFillsDto.query = { filter: { beamDuration: '100', beamDurationOperator: '>=', hasStableBeams: true } };
135+
const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto)
136+
console.log(lhcFills);
137+
138+
expect(lhcFills).to.be.an('array').and.lengthOf(4)
139+
lhcFills.forEach((lhcFill) => {
140+
expect(lhcFill.stableBeamsDuration).greaterThanOrEqual(100)
141+
});
142+
})
143+
144+
it('should only contain specified stable beam durations, > 00:01:40', async () => {
145+
getAllLhcFillsDto.query = { filter: { beamDuration: '100', beamDurationOperator: '>', hasStableBeams: true } };
146+
const { lhcFills } = await new GetAllLhcFillsUseCase().execute(getAllLhcFillsDto)
147+
console.log(lhcFills);
148+
149+
expect(lhcFills).to.be.an('array').and.lengthOf(2)
150+
lhcFills.forEach((lhcFill) => {
151+
expect(lhcFill.stableBeamsDuration).greaterThan(100)
152+
});
153+
})
103154
};

test/public/lhcFills/overview.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,16 @@ module.exports = () => {
270270
const filterSBExpect = { selector: 'div.items-baseline:nth-child(2) > div:nth-child(1)', value: 'Stable Beams Only' };
271271
const filterFillNRExpect = {selector: 'div.items-baseline:nth-child(1) > div:nth-child(1)', value: 'Fill #'}
272272
const filterSBDurationExpect = {selector: 'div.items-baseline:nth-child(3) > div:nth-child(1)', value: 'SB Duration'}
273+
const filterSBDurationOperatorExpect = {selector: 'select.form-control', value: '='}
274+
const filterSBDurationOperatorEqualsPath = 'select.form-control > option:nth-child(3)';
273275

274276

275277
await goToPage(page, 'lhc-fill-overview');
276278
await pressElement(page, filterButtonSellector);
277279
await expectInnerText(page, filterSBExpect.selector, filterSBExpect.value);
278280
await expectInnerText(page, filterFillNRExpect.selector, filterFillNRExpect.value);
279281
await expectInnerText(page, filterSBDurationExpect.selector, filterSBDurationExpect.value);
282+
await expectInnerText(page, filterSBDurationOperatorExpect.selector, filterSBDurationOperatorExpect.value);
280283
});
281284

282285

0 commit comments

Comments
 (0)