Skip to content

Commit 25392db

Browse files
committed
[O2B-1546] Added deleted QC flag, adjust seed file and tests
Added a new deleted QC flag (id 103). Update API, service and public tests to account for the additional flag and adjust selectors and counters in the UI test. Also fix several test title typos.
1 parent d3e389a commit 25392db

4 files changed

Lines changed: 38 additions & 17 deletions

File tree

lib/database/seeders/20240404100811-qc-flags.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ module.exports = {
253253
// Run : 56, FT0
254254
{
255255
id: 100,
256-
deleted: true,
256+
deleted: false,
257257
from: null,
258258
to: '2019-08-08 20:50:00',
259259
comment: 'first part good',
@@ -281,6 +281,21 @@ module.exports = {
281281
created_at: '2024-08-12 12:00:10',
282282
updated_at: '2024-08-12 12:00:10',
283283
},
284+
{
285+
id: 103,
286+
deleted: true,
287+
from: null,
288+
to: '2019-08-08 20:50:00',
289+
comment: 'deleted flag',
290+
291+
run_number: 56,
292+
flag_type_id: 13, // Bad
293+
created_by_id: 2,
294+
detector_id: 7, // FT0
295+
296+
created_at: '2024-08-12 12:00:15',
297+
updated_at: '2024-08-12 12:00:15',
298+
},
284299

285300
// Run : 56, ITS
286301
{
@@ -394,6 +409,12 @@ module.exports = {
394409
from: '2019-08-08 20:50:00',
395410
to: null,
396411
},
412+
{
413+
id: 103,
414+
flag_id: 103,
415+
from: null,
416+
to: '2019-08-08 20:50:00',
417+
},
397418

398419
// Run : 56, ITS
399420
{

test/api/qcFlags.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,20 +743,20 @@ module.exports = () => {
743743
const response = await request(server).get(`/api/qcFlags/synchronous?runNumber=${runNumber}&detectorId=${detectorId}`);
744744
expect(response.status).to.be.equal(200);
745745
const { data: flags, meta } = response.body;
746-
expect(meta).to.be.eql({ page: { totalCount: 2, pageCount: 1 } });
747-
expect(flags.map(({ id }) => id)).to.have.all.ordered.members([101, 100]);
746+
expect(meta).to.be.eql({ page: { totalCount: 3, pageCount: 1 } });
747+
expect(flags.map(({ id }) => id)).to.have.all.ordered.members([103, 101, 100]);
748748
});
749749

750750
it('should successfully fetch synchronous flags with pagination', async () => {
751751
const runNumber = 56;
752752
const detectorId = 7;
753753
{
754754
const response = await request(server)
755-
.get(`/api/qcFlags/synchronous?runNumber=${runNumber}&detectorId=${detectorId}&page[limit]=1&page[offset]=1`);
755+
.get(`/api/qcFlags/synchronous?runNumber=${runNumber}&detectorId=${detectorId}&page[limit]=1&page[offset]=2`);
756756

757757
expect(response.status).to.be.equal(200);
758758
const { data: flags, meta } = response.body;
759-
expect(meta).to.be.eql({ page: { totalCount: 2, pageCount: 2 } });
759+
expect(meta).to.be.eql({ page: { totalCount: 3, pageCount: 3 } });
760760
expect(flags).to.be.lengthOf(1);
761761
const [flag] = flags;
762762
expect(flag.id).to.be.equal(100);
@@ -770,7 +770,7 @@ module.exports = () => {
770770
{
771771
const response = await request(server)
772772
.get(`/api/qcFlags/synchronous?runNumber=${runNumber}&detectorId=${detectorId}&filter[createdBy][names]=Jan%20Jansen&filter[createdBy][operator]=or`);
773-
expect(response.body.data).to.be.lengthOf(2);
773+
expect(response.body.data).to.be.lengthOf(3);
774774
}
775775

776776
{

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ module.exports = () => {
142142
const detectorId = 7;
143143
{
144144
const { rows: flags, count } = await qcFlagService.getAllSynchronousPerRunAndDetector({ runNumber, detectorId });
145-
expect(count).to.be.equal(2);
146-
expect(flags.map(({ id }) => id)).to.have.all.ordered.members([101, 100]);
145+
expect(count).to.be.equal(3);
146+
expect(flags.map(({ id }) => id)).to.have.all.ordered.members([103, 101, 100]);
147147
}
148148
{
149149
const { rows: flags, count } = await qcFlagService.getAllSynchronousPerRunAndDetector(
150150
{ runNumber, detectorId },
151-
{ limit: 1, offset: 1 },
151+
{ limit: 1, offset: 2 },
152152
);
153-
expect(count).to.be.equal(2);
153+
expect(count).to.be.equal(3);
154154
expect(flags).to.be.lengthOf(1);
155155
const [flag] = flags;
156156
expect(flag.id).to.be.equal(100);
@@ -2124,10 +2124,10 @@ module.exports = () => {
21242124
});
21252125
});
21262126

2127-
it('should successfult fiter sync flags by created by name', async () => {
2127+
it('should successfully filter sync flags by created by name', async () => {
21282128
{
21292129
const { rows } = await qcFlagService.getAllSynchronousPerRunAndDetector({ runNumber: 56, detectorId: 7 }, {}, { createdBy: { names: ['Jan Jansen'], operator: 'or' }});
2130-
expect(rows).to.be.lengthOf(2);
2130+
expect(rows).to.be.lengthOf(3);
21312131
}
21322132

21332133
{
@@ -2136,7 +2136,7 @@ module.exports = () => {
21362136
}
21372137
});
21382138

2139-
it('should successfult fiter data pass flags by created by name', async () => {
2139+
it('should successfully filter data pass flags by created by name', async () => {
21402140
{
21412141
const { rows } = await qcFlagService.getAllPerDataPassAndRunAndDetector({ dataPassId: 1, runNumber: 107, detectorId: 1 }, {}, { createdBy: { names: ['John Doe'], operator: 'or' }});
21422142
expect(rows).to.be.lengthOf(2);
@@ -2148,7 +2148,7 @@ module.exports = () => {
21482148
}
21492149
});
21502150

2151-
it('should successfult fiter simulation pass flags by created by name', async () => {
2151+
it('should successfully filter simulation pass flags by created by name', async () => {
21522152
{
21532153
const { rows } = await qcFlagService.getAllPerSimulationPassAndRunAndDetector({ simulationPassId: 1, runNumber: 106, detectorId: 1 }, {}, { createdBy: { names: ['Jan Jansen'], operator: 'or' }});
21542154
expect(rows).to.be.lengthOf(2);

test/public/qcFlags/synchronousOverview.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ module.exports = () => {
8484

8585
it('Should display the correct items counter at the bottom of the page', async () => {
8686
await expectInnerText(page, '#firstRowIndex', '1');
87-
await expectInnerText(page, '#lastRowIndex', '2');
88-
await expectInnerText(page, '#totalRowsCount', '2');
87+
await expectInnerText(page, '#lastRowIndex', '3');
88+
await expectInnerText(page, '#totalRowsCount', '3');
8989
});
9090

9191
it('should display Comment tooltip with full information', async () => {
@@ -105,7 +105,7 @@ module.exports = () => {
105105
});
106106

107107
it('should display correct Deleted text colour', async () => {
108-
const deletedCell = await page.$('#row100-deleted-text:nth-child(1)');
108+
const deletedCell = await page.$('#row103-deleted-text:nth-child(1)');
109109

110110
const deletedCellText = await page.evaluate(cell => cell.textContent.trim(), deletedCell);
111111
expect(deletedCellText).to.equal('Yes');

0 commit comments

Comments
 (0)