Skip to content

Commit 6a7c15f

Browse files
committed
add test
1 parent 8c57ccc commit 6a7c15f

2 files changed

Lines changed: 150 additions & 2 deletions

File tree

test/api/qcFlags.test.js

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ module.exports = () => {
8989
mcReproducible: false,
9090
missingVerificationsCount: 1,
9191
},
92+
22: {
93+
badEffectiveRunCoverage: 0.2222222,
94+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
95+
mcReproducible: false,
96+
missingVerificationsCount: 2,
97+
}
9298
},
9399
107: {
94100
1: {
@@ -125,6 +131,12 @@ module.exports = () => {
125131
mcReproducible: false,
126132
missingVerificationsCount: 1,
127133
},
134+
22: {
135+
badEffectiveRunCoverage: 0.2222222,
136+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
137+
mcReproducible: false,
138+
missingVerificationsCount: 2,
139+
}
128140
},
129141
107: {
130142
1: {
@@ -143,6 +155,68 @@ module.exports = () => {
143155
});
144156
});
145157

158+
it('should successfully get non-empty QC flags summary for a data pass when filtering by CreatedBy and detectors', async () => {
159+
{
160+
const response = await request(server).get('/api/qcFlags/summary?dataPassId=1&detectorIds=22,1'); // VTX and CPV
161+
expect(response.status).to.be.equal(200);
162+
const { body: { data } } = response;
163+
expect(data).to.be.eql({
164+
106: {
165+
22: {
166+
badEffectiveRunCoverage: 0.2222222,
167+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
168+
mcReproducible: false,
169+
missingVerificationsCount: 2
170+
},
171+
1: {
172+
missingVerificationsCount: 3,
173+
mcReproducible: true,
174+
badEffectiveRunCoverage: 0.3333333,
175+
explicitlyNotBadEffectiveRunCoverage: 0,
176+
},
177+
},
178+
107: {
179+
1: {
180+
badEffectiveRunCoverage: 0.2403462,
181+
explicitlyNotBadEffectiveRunCoverage: 0.7596538,
182+
mcReproducible: true,
183+
missingVerificationsCount: 2,
184+
},
185+
},
186+
});
187+
}
188+
189+
{
190+
const response = await request(server).get('/api/qcFlags/summary?dataPassId=1&detectorIds=22,1&filter[createdBy][names]=Anonymous&filter[createdBy][operator]=none'); // VTX and CPV
191+
expect(response.status).to.be.equal(200);
192+
const { body: { data } } = response;
193+
expect(data).to.be.eql({
194+
106: {
195+
22: {
196+
badEffectiveRunCoverage: 0,
197+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
198+
mcReproducible: false,
199+
missingVerificationsCount: 1
200+
},
201+
1: {
202+
missingVerificationsCount: 3,
203+
mcReproducible: true,
204+
badEffectiveRunCoverage: 0.3333333,
205+
explicitlyNotBadEffectiveRunCoverage: 0,
206+
},
207+
},
208+
107: {
209+
1: {
210+
badEffectiveRunCoverage: 0.2403462,
211+
explicitlyNotBadEffectiveRunCoverage: 0.7596538,
212+
mcReproducible: true,
213+
missingVerificationsCount: 2,
214+
},
215+
},
216+
});
217+
}
218+
});
219+
146220
it('should successfully get non-empty QC flag summary for simulation pass', async () => {
147221
const response = await request(server).get('/api/qcFlags/summary?simulationPassId=1');
148222
expect(response.status).to.be.equal(200);
@@ -701,7 +775,7 @@ module.exports = () => {
701775
.delete(`/api/qcFlags/perDataPass?dataPassId=${dataPassId}&token=${BkpRoles.DPG_ASYNC_QC_ADMIN}`);
702776

703777
expect(response.status).to.be.equal(200);
704-
expect(response.body.data.deletedCount).to.equal(9); // 7 from seeders, 2 created in POST requests previously in this test
778+
expect(response.body.data.deletedCount).to.equal(11); // 9 from seeders, 2 created in POST requests previously in this test
705779
});
706780
});
707781

test/lib/server/services/qualityControlFlag/QcFlagService.test.js

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ module.exports = () => {
176176
mcReproducible: false,
177177
missingVerificationsCount: 1,
178178
},
179+
22: {
180+
badEffectiveRunCoverage: 0.2222222,
181+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
182+
mcReproducible: false,
183+
missingVerificationsCount: 2
184+
},
179185
},
180186
107: {
181187
1: {
@@ -209,6 +215,12 @@ module.exports = () => {
209215
mcReproducible: false,
210216
missingVerificationsCount: 1,
211217
},
218+
22: {
219+
badEffectiveRunCoverage: 0.2222222,
220+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
221+
mcReproducible: false,
222+
missingVerificationsCount: 2
223+
},
212224
},
213225
107: {
214226
1: {
@@ -324,6 +336,68 @@ module.exports = () => {
324336
},
325337
});
326338
});
339+
340+
it('should successfully get non-empty QC flags summary for a data pass when filtering by CreatedBy and detectors', async () => {
341+
{
342+
const data = await qcFlagSummaryService.getSummary({ dataPassId: 1, dplDetectorIds: [22, 1] })
343+
expect(data).to.be.eql({
344+
106: {
345+
22: {
346+
badEffectiveRunCoverage: 0.2222222,
347+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
348+
mcReproducible: false,
349+
missingVerificationsCount: 2
350+
},
351+
1: {
352+
missingVerificationsCount: 3,
353+
mcReproducible: true,
354+
badEffectiveRunCoverage: 0.3333333,
355+
explicitlyNotBadEffectiveRunCoverage: 0,
356+
},
357+
},
358+
107: {
359+
1: {
360+
badEffectiveRunCoverage: 0.2403462,
361+
explicitlyNotBadEffectiveRunCoverage: 0.7596538,
362+
mcReproducible: true,
363+
missingVerificationsCount: 2,
364+
},
365+
},
366+
});
367+
}
368+
369+
{
370+
const data = await qcFlagSummaryService.getSummary(
371+
{ dataPassId: 1, dplDetectorIds: [22, 1] },
372+
{},
373+
{ createdBy: { names: ['Anonymous'], operator: 'none' }}
374+
)
375+
expect(data).to.be.eql({
376+
106: {
377+
22: {
378+
badEffectiveRunCoverage: 0,
379+
explicitlyNotBadEffectiveRunCoverage: 0.7777778,
380+
mcReproducible: false,
381+
missingVerificationsCount: 1
382+
},
383+
1: {
384+
missingVerificationsCount: 3,
385+
mcReproducible: true,
386+
badEffectiveRunCoverage: 0.3333333,
387+
explicitlyNotBadEffectiveRunCoverage: 0,
388+
},
389+
},
390+
107: {
391+
1: {
392+
badEffectiveRunCoverage: 0.2403462,
393+
explicitlyNotBadEffectiveRunCoverage: 0.7596538,
394+
mcReproducible: true,
395+
missingVerificationsCount: 2,
396+
},
397+
},
398+
});
399+
}
400+
})
327401
});
328402

329403
describe('Creating Quality Control Flag for data pass', async () => {
@@ -1408,7 +1482,7 @@ module.exports = () => {
14081482
},
14091483
},
14101484
},
1411-
})).to.lengthOf(13); // 14 from seeders, then 1 deleted => 10
1485+
})).to.lengthOf(16); // 14 from seeders, then 1 deleted => 10
14121486

14131487
expect((await QcFlagRepository.findAll({
14141488
include: {

0 commit comments

Comments
 (0)