Skip to content

Commit 2cde081

Browse files
committed
HARMONY-1998: Test message category filter
1 parent 952064f commit 2cde081

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

services/harmony/test/workflow-ui/work-items-table.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ describe('Workflow UI work items table route', function () {
131131
await otherItem3.save(this.trx);
132132
const otherItem4 = buildWorkItem({ jobID: otherJob.jobID, status: WorkItemStatus.READY });
133133
await otherItem4.save(this.trx);
134+
const otherItem5 = buildWorkItem({ jobID: otherJob.jobID, status: WorkItemStatus.WARNING, message_category: 'no-data' });
135+
await otherItem5.save(this.trx);
134136
const otherStep1 = buildWorkflowStep({ jobID: otherJob.jobID, stepIndex: 1 });
135137
await otherStep1.save(this.trx);
136138
const otherStep2 = buildWorkflowStep({ jobID: otherJob.jobID, stepIndex: 2 });
@@ -572,7 +574,7 @@ describe('Workflow UI work items table route', function () {
572574
hookWorkflowUIWorkItems({ username: 'adam', jobID: otherJob.jobID });
573575
it('returns metrics logs links for each each work item', function () {
574576
const listing = this.res.text;
575-
expect((listing.match(/logs-metrics/g) || []).length).to.equal(4);
577+
expect((listing.match(/logs-metrics/g) || []).length).to.equal(5);
576578
});
577579
});
578580

@@ -585,6 +587,24 @@ describe('Workflow UI work items table route', function () {
585587
});
586588
});
587589

590+
describe('when the admin filters otherJob\'s items by status IN [WARNING]', function () {
591+
hookWorkflowUIWorkItems({ username: 'adam', jobID: otherJob.jobID,
592+
query: { tableFilter: '[{"value":"status: warning","dbValue":"warning","field":"status"}]' } });
593+
it('contains the WARNING work item', async function () {
594+
expect((this.res.text.match(/work-item-table-row/g) || []).length).to.equal(1);
595+
expect(this.res.text).to.contain(`<span class="badge rounded-pill bg-warning">${WorkItemStatus.WARNING.valueOf()}: no-data</span>`);
596+
});
597+
});
598+
599+
describe('when the admin filters otherJob\'s items by message_category IN [no-data]', function () {
600+
hookWorkflowUIWorkItems({ username: 'adam', jobID: otherJob.jobID,
601+
query: { tableFilter: '[{"value":"message category: no-data","dbValue":"no-data","field":"message_category"}]' } });
602+
it('contains the no-data work item', async function () {
603+
expect((this.res.text.match(/work-item-table-row/g) || []).length).to.equal(1);
604+
expect(this.res.text).to.contain(`<span class="badge rounded-pill bg-warning">${WorkItemStatus.WARNING.valueOf()}: no-data</span>`);
605+
});
606+
});
607+
588608
describe('when the user is not part of the admin group', function () {
589609
hookAdminWorkflowUIWorkItems({ username: 'eve', jobID: targetJob.jobID });
590610
it('returns an error', function () {

0 commit comments

Comments
 (0)