Skip to content

Commit 7364379

Browse files
author
GuustMetz
committed
add usecase tests
1 parent 6fd6bfd commit 7364379

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test/lib/usecases/run/GetAllRunsUseCase.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,32 @@ module.exports = () => {
183183
}
184184
});
185185

186+
it('should successfully filter on beamModes', async () => {
187+
const singleBeamMode = ['STABLE BEAMS'];
188+
const multipleBeamMode = ['STABLE BEAMS', 'NO BEAM'];
189+
const nonExistentBeamMode = ['DOES NOT EXIST'];
190+
191+
getAllRunsDto.query = { filter: { beamModes: singleBeamMode } };
192+
{
193+
const { runs } = await new GetAllRunsUseCase().execute(getAllRunsDto);
194+
expect(runs).to.have.lengthOf(5);
195+
expect(runs.every(({ lhcBeamMode }) => singleBeamMode.includes(lhcBeamMode))).to.be.true;
196+
}
197+
198+
getAllRunsDto.query = { filter: { beamModes: multipleBeamMode } };
199+
{
200+
const { runs } = await new GetAllRunsUseCase().execute(getAllRunsDto);
201+
expect(runs).to.have.lengthOf(6);
202+
expect(runs.every(({ lhcBeamMode }) => multipleBeamMode.includes(lhcBeamMode))).to.be.true;
203+
}
204+
205+
getAllRunsDto.query = { filter: { beamModes: nonExistentBeamMode } };
206+
{
207+
const { runs } = await new GetAllRunsUseCase().execute(getAllRunsDto);
208+
expect(runs).to.have.lengthOf(0);
209+
}
210+
});
211+
186212
it('should successfully filter on run definition', async () => {
187213
const PHYSICS_COUNT = 7;
188214
const COSMICS_COUNT = 2;

0 commit comments

Comments
 (0)