Skip to content

Commit

Permalink
Update packages/quantic/force-app/main/default/lwc/quanticCaseClassif…
Browse files Browse the repository at this point in the history
…ication/__tests__/quanticCaseClassification.test.js

Co-authored-by: Etienne Rocheleau <erocheleau@coveo.com>
  • Loading branch information
mmitiche and erocheleau authored Feb 27, 2025
1 parent 5885d8f commit f385842
Showing 1 changed file with 29 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -698,56 +698,35 @@ describe('c-quantic-case-classification', () => {
};
});

describe('the case classification suggestions', () => {
it('should not display any case classification suggestions', async () => {
const element = createTestComponent();
mockGetPicklistValuesByRecordTypeWire();

await flushPromises();

const suggestions = element.shadowRoot.querySelectorAll(
selectors.caseClassificationSuggestion
);

expect(suggestions.length).toBe(0);
});
});

describe('the case classification all options', () => {
it('should not display the show select input button', async () => {
const element = createTestComponent();
mockGetPicklistValuesByRecordTypeWire();

await flushPromises();

const showSelectInputButton = element.shadowRoot.querySelector(
selectors.showSelectInputButton
);

expect(showSelectInputButton).toBeNull();
});

it('should only display the all options select input', async () => {
const element = createTestComponent();
mockGetPicklistValuesByRecordTypeWire();

await flushPromises();

const allOptionsSelectInput = element.shadowRoot.querySelector(
selectors.allOptionsSelectInput
);

expect(allOptionsSelectInput).not.toBeNull();
expect(allOptionsSelectInput.options).toStrictEqual(
exampleCaseClassificationAllOptions
);
expect(allOptionsSelectInput.value).not.toBeDefined();
expect(allOptionsSelectInput.placeholder).toBe(
exampleMoreTopicsLabel
);
});
});
});
it('should not display any case classification suggestions, but still display the options select input', async () => {
const element = createTestComponent();
mockGetPicklistValuesByRecordTypeWire();

await flushPromises();

const suggestions = element.shadowRoot.querySelectorAll(
selectors.caseClassificationSuggestion
);
expect(suggestions.length).toBe(0);

const showSelectInputButton = element.shadowRoot.querySelector(
selectors.showSelectInputButton
);
expect(showSelectInputButton).toBeNull();

const allOptionsSelectInput = element.shadowRoot.querySelector(
selectors.allOptionsSelectInput
);

expect(allOptionsSelectInput).not.toBeNull();
expect(allOptionsSelectInput.options).toStrictEqual(
exampleCaseClassificationAllOptions
);
expect(allOptionsSelectInput.value).not.toBeDefined();
expect(allOptionsSelectInput.placeholder).toBe(
exampleMoreTopicsLabel
);
});
});

describe('the reportValidity public method', () => {
Expand Down

0 comments on commit f385842

Please sign in to comment.