Skip to content

Commit

Permalink
Remove duplicated tests in RecsListTable (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikerreyes authored May 6, 2022
1 parent f5543c0 commit 3d8f9de
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/Components/RecsListTable/RecsListTable.spec.ct.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ import {
itemsPerPage,
} from '../../../cypress/utils/pagination';
import { TOTAL_RISK, CATEGORIES } from '../../../cypress/utils/globals';
import { RECS_LIST_COLUMNS } from '../../AppConstants';
import {
checkRowCounts,
columnName2UrlParam,
checkTableHeaders,
} from '../../../cypress/utils/table';
// TODO make more use of ../../../cypress/utils/components

Expand All @@ -43,6 +45,7 @@ const DEFAULT_FILTERS = {
impacting: 'true',
rule_status: 'enabled',
};
const TABLE_HEADERS = _.map(RECS_LIST_COLUMNS, (it) => it.title);

const data = ruleResponse.recommendations;

Expand Down Expand Up @@ -221,6 +224,10 @@ describe('successful non-empty recommendations list table', () => {
});
});

it('renders table header', () => {
checkTableHeaders(TABLE_HEADERS);
});

it('renders Clusters impacted chip group', () => {
cy.get(ROOT)
.find('span[class=pf-c-chip-group__label]')
Expand Down Expand Up @@ -267,24 +274,12 @@ describe('successful non-empty recommendations list table', () => {
);
});

// TODO do not hardcode data
it('table has 4 recs', () => {
checkRowCounts(4);
});

// TODO do not hardcode data
it('table has 7 recs including non-impacting', () => {
cy.removeImpactingFilter();
checkRowCounts(7);
});

// TODO do not hardcode data
it('should have 5 sortable columns', () => {
cy.getColumns()
.should('have.length', 5)
.should('have.class', 'pf-c-table__sort');
});

describe('defaults', () => {
// TODO enhance tests See ClustersListTable

Expand Down

0 comments on commit 3d8f9de

Please sign in to comment.