Skip to content

Commit 7a00043

Browse files
author
Guust
committed
add happy-flow tests for logs api
1 parent b860320 commit 7a00043

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

test/api/logs.test.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ module.exports = () => {
233233
});
234234

235235
it('should successfully filter by run number', async () => {
236-
const response = await request(server).get('/api/logs?filter[run][values]=1,2&filter[run][operation]=and');
236+
const response = await request(server).get('/api/logs?filter[runNumbers]=1,2');
237237
expect(response.status).to.equal(200);
238238

239239
expect(response.body.data).to.be.an('array');
@@ -244,6 +244,30 @@ module.exports = () => {
244244
}
245245
});
246246

247+
it('should successfully filter by lhcFillNumber', async () => {
248+
const response = await request(server).get('/api/logs?filter[fillNumbers]=1,4,6');
249+
expect(response.status).to.equal(200);
250+
251+
expect(response.body.data).to.be.an('array');
252+
expect(response.body.data).to.lengthOf(1);
253+
for (const { lhcFills } of response.body.data) {
254+
const fillNumbers = lhcFills.map(({ fillNumber }) => fillNumber);
255+
expect([1, 4, 6].every((fillNumber) => fillNumbers.includes(fillNumber))).to.be.true;
256+
}
257+
});
258+
259+
it('should successfully filter by EnvironmentIds', async () => {
260+
const response = await request(server).get('/api/logs?filter[environmentIds]=Dxi029djX,eZF99lH6');
261+
expect(response.status).to.equal(200);
262+
263+
expect(response.body.data).to.be.an('array');
264+
expect(response.body.data).to.lengthOf(1);
265+
for (const { environments } of response.body.data) {
266+
const environmentIds = environments.map(({ id }) => id);
267+
expect(["Dxi029djX", "eZF99lH6"].every((environmentId) => environmentIds.includes(environmentId))).to.be.true;
268+
}
269+
});
270+
247271
it('should successfully filter by content', async () => {
248272
const response = await request(server).get('/api/logs?filter[content]=particle');
249273
expect(response.status).to.equal(200);

0 commit comments

Comments
 (0)