Commit 6c6bd840 authored by Illya Klymov's avatar Illya Klymov

Replace usage of find/findAll in ee/spec/frontend/compliance_dashboard

* migrate to proper use of findComponent/findAllComponents
parent 68755b38
......@@ -8,7 +8,7 @@ const IMAGE_PATH = 'empty.svg';
describe('EmptyState component', () => {
let wrapper;
const emptyStateProp = (prop) => wrapper.find(GlEmptyState).props(prop);
const emptyStateProp = (prop) => wrapper.findComponent(GlEmptyState).props(prop);
const createComponent = (props = {}) => {
return shallowMount(EmptyState, {
......
......@@ -10,7 +10,7 @@ describe('MergeRequest component', () => {
const findMessage = () => wrapper.find('[data-testid="approvers"]');
const findCounter = () => wrapper.find('.avatar-counter');
const findAvatarLinks = () => wrapper.findAll(GlAvatarLink);
const findAvatarLinks = () => wrapper.findAllComponents(GlAvatarLink);
const createComponent = (approvers = []) => {
return shallowMount(Approvers, {
......
......@@ -9,12 +9,12 @@ const CSV_EXPORT_PATH = '/merge_commit_reports';
describe('MergeCommitsExportButton component', () => {
let wrapper;
const findCommitForm = () => wrapper.find(GlForm);
const findCommitInput = () => wrapper.find(GlFormInput);
const findCommitInputGroup = () => wrapper.find(GlFormGroup);
const findCommitForm = () => wrapper.findComponent(GlForm);
const findCommitInput = () => wrapper.findComponent(GlFormInput);
const findCommitInputGroup = () => wrapper.findComponent(GlFormGroup);
const findCommitInputFeedback = () => wrapper.find('.invalid-feedback');
const findCommitExportButton = () => wrapper.find('[data-test-id="merge-commit-submit-button"]');
const findCsvExportButton = () => wrapper.find({ ref: 'listMergeCommitsButton' });
const findCsvExportButton = () => wrapper.findComponent({ ref: 'listMergeCommitsButton' });
const createComponent = ({ mountFn = shallowMount, data = {} } = {}) => {
return mountFn(MergeCommitsExportButton, {
......
......@@ -9,7 +9,7 @@ import { createMergeRequest } from '../../mock_data';
describe('MergeRequest component', () => {
let wrapper;
const findAuthorAvatarLink = () => wrapper.find('.issuable-authored').find(GlAvatarLink);
const findAuthorAvatarLink = () => wrapper.find('.issuable-authored').findComponent(GlAvatarLink);
const findComplianceFrameworkLabel = () => wrapper.findComponent(ComplianceFrameworkLabel);
const createComponent = (mergeRequest) => {
......@@ -54,7 +54,7 @@ describe('MergeRequest component', () => {
});
it('renders the author avatar', () => {
expect(findAuthorAvatarLink().find(GlAvatar).exists()).toEqual(true);
expect(findAuthorAvatarLink().findComponent(GlAvatar).exists()).toEqual(true);
});
it('renders the author name', () => {
......
......@@ -16,9 +16,9 @@ describe('Status component', () => {
const checkStatusComponentExists = (status, exists) => {
switch (status.type) {
case 'approval':
return expect(wrapper.find(Approval).exists()).toBe(exists);
return expect(wrapper.findComponent(Approval).exists()).toBe(exists);
case 'pipeline':
return expect(wrapper.find(Pipeline).exists()).toBe(exists);
return expect(wrapper.findComponent(Pipeline).exists()).toBe(exists);
default:
throw new Error(`Unknown status type: ${status.type}`);
}
......
......@@ -7,7 +7,7 @@ describe('ApprovalStatus component', () => {
let wrapper;
const findIcon = () => wrapper.find('.ci-icon');
const findLink = () => wrapper.find(GlLink);
const findLink = () => wrapper.findComponent(GlLink);
const createComponent = (status) => {
return shallowMount(Approval, {
......
......@@ -8,7 +8,7 @@ describe('Pipeline component', () => {
let wrapper;
const findCiIcon = () => wrapper.find('.ci-icon');
const findCiLink = () => wrapper.find(GlLink);
const findCiLink = () => wrapper.findComponent(GlLink);
const createComponent = (status) => {
return shallowMount(Pipeline, {
......
......@@ -88,7 +88,7 @@ describe('ComplianceReport component', () => {
});
it('renders the subheading with a help link', () => {
const helpLink = findSubheading().find(GlLink);
const helpLink = findSubheading().findComponent(GlLink);
expect(findSubheading().text()).toContain(
'The compliance report shows the merge request violations merged in protected environments.',
......
......@@ -35,7 +35,7 @@ describe('BranchDetails component', () => {
});
it('has no links', () => {
expect(wrapper.find(GlLink).exists()).toBe(false);
expect(wrapper.findComponent(GlLink).exists()).toBe(false);
});
it('has the correct text', () => {
......@@ -49,7 +49,7 @@ describe('BranchDetails component', () => {
});
it('has one link', () => {
expect(wrapper.findAll(GlLink)).toHaveLength(1);
expect(wrapper.findAllComponents(GlLink)).toHaveLength(1);
});
it('has a link to the target branch', () => {
......@@ -67,7 +67,7 @@ describe('BranchDetails component', () => {
});
it('has two links', () => {
expect(wrapper.findAll(GlLink)).toHaveLength(2);
expect(wrapper.findAllComponents(GlLink)).toHaveLength(2);
});
it('has a link to the source branch', () => {
......
......@@ -7,7 +7,7 @@ describe('Pagination component', () => {
let wrapper;
const origin = 'https://localhost';
const findGlPagination = () => wrapper.find(GlPagination);
const findGlPagination = () => wrapper.findComponent(GlPagination);
const getLink = (query) => wrapper.find(query).element.getAttribute('href');
const findPrevPageLink = () => getLink('a.prev-page-item');
const findNextPageLink = () => getLink('a.next-page-item');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment