Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix affects impact and resolution ordering #517

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

C-Valen
Copy link
Member

@C-Valen C-Valen commented Dec 12, 2024

OSIDB-3480: Fix incorrect affects ordering

Checklist:

  • Commits consolidated
  • Changelog updated
  • Test cases added/updated
  • Jira ticket updated

Summary:

Fix wrong sorting on affects table by Impact and Resolution

Changes:

  • Fix affects sorting comparator
  • Add new test cases

Closes OSIDB-3480

@C-Valen C-Valen self-assigned this Dec 12, 2024
@C-Valen C-Valen added the bug Something isn't working label Dec 12, 2024
@C-Valen C-Valen changed the title 🐛 Fix affects string columns ordering 🐛 Fix affects sotring columns ordering Dec 12, 2024
@C-Valen C-Valen changed the title 🐛 Fix affects sotring columns ordering 🐛 Fix affects impact and resolution ordering Dec 12, 2024
@C-Valen C-Valen force-pushed the fix/OSIDB-3480-incorrect-affects-ordering branch from 364ff56 to 3f7f88c Compare December 12, 2024 10:43
@C-Valen C-Valen force-pushed the fix/OSIDB-3480-incorrect-affects-ordering branch from 3f7f88c to 1d92228 Compare December 16, 2024 15:15
@C-Valen C-Valen marked this pull request as ready for review December 16, 2024 15:20
@@ -326,7 +326,7 @@ describe('flawAffects', () => {
expect(affectsTableRows.length).toBe(6);
});

osimFullFlawTest('Affects can be sorted by clicking on the field column', async () => {
osimFullFlawTest('Affects can be sorted by component column', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can replace all this "sorting" tests with a parametrized test

  osimFullFlawTest.each([
    { column: 'Module', columnIndex: 3, first: 'openshift-6', last: 'openshift-1' },
    { column: 'Component', columnIndex: 4, first: 'openshift-1-1', last: 'openshift-6-1' },
    { column: 'Affectedness', columnIndex: 5, first: 'AFFECTED', last: '' },
    { column: 'Resolution', columnIndex: 6, first: 'DELEGATED', last: 'WONTFIX' },
    { column: 'Impact', columnIndex: 7, first: 'CRITICAL', last: 'LOW' },
    { column: 'Trackers', columnIndex: 9, first: '0', last: '4' },
  ])('Affects can be sorted by $column column', async ({ column, columnIndex, first, last }) => {
    const componentHeader = subject.find(`.affects-management table thead tr th:nth-of-type(${columnIndex})`);
    expect(componentHeader.text()).toStrictEqual(expect.stringMatching(column));

    // Ascending order
    await componentHeader.trigger('click');

    let affectsTableRows = subject.findAll('.affects-management table tbody tr');
    let firstAffect = affectsTableRows[0];
    let lastAffect = affectsTableRows.at(-1)!;

    expect(firstAffect.find(`td:nth-of-type(${columnIndex}) span`).text()).toBe(first);
    expect(lastAffect.find(`td:nth-of-type(${columnIndex}) span`).text()).toBe(last);

    // Descending order
    await componentHeader.trigger('click');

    affectsTableRows = subject.findAll('.affects-management table tbody tr');
    firstAffect = affectsTableRows[0];
    lastAffect = affectsTableRows.at(-1)!;

    expect(firstAffect.find(`td:nth-of-type(${columnIndex}) span`).text()).toBe(last);
    expect(lastAffect.find(`td:nth-of-type(${columnIndex}) span`).text()).toBe(first);
  });

Copy link
Member

@MrMarble MrMarble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have a suggestion for the tests, otherwise LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants