Commit 9787d81c authored by Illya Klymov's avatar Illya Klymov

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

* migrate to proper use of findComponent/findAllComponents
parent 68755b38
......@@ -7,7 +7,7 @@ import { trimText } from 'helpers/text_helper';
describe('AlertFilters component', () => {
let wrapper;
const findDropdownItemAtIndex = (index) => wrapper.findAll(GlDropdownItem).at(index);
const findDropdownItemAtIndex = (index) => wrapper.findAllComponents(GlDropdownItem).at(index);
const clickDropdownItemAtIndex = (index) => findDropdownItemAtIndex(index).vm.$emit('click');
const findSearch = () => wrapper.findComponent(GlSearchBoxByType);
const findDropdownMessage = () =>
......
......@@ -13,8 +13,8 @@ describe('AlertStatus', () => {
mutate: jest.fn(),
};
const findStatusDropdown = () => wrapper.find(GlDropdown);
const findFirstStatusOption = () => findStatusDropdown().find(GlDropdownItem);
const findStatusDropdown = () => wrapper.findComponent(GlDropdown);
const findFirstStatusOption = () => findStatusDropdown().findComponent(GlDropdownItem);
const selectFirstStatusOption = () => {
findFirstStatusOption().vm.$emit('click');
......
......@@ -5,7 +5,7 @@ import AlertsList from 'ee/threat_monitoring/components/alerts/alerts_list.vue';
describe('Alerts component', () => {
let wrapper;
const findAlertsList = () => wrapper.find(AlertsList);
const findAlertsList = () => wrapper.findComponent(AlertsList);
const createWrapper = () => {
wrapper = shallowMount(Alerts);
......
......@@ -12,8 +12,8 @@ const emptyStateSvgPath = '/svgs';
describe('NoEnvironmentEmptyState component', () => {
let wrapper;
const findGlEmptyState = () => wrapper.find(GlEmptyState);
const findGlSprintf = () => wrapper.find(GlSprintf);
const findGlEmptyState = () => wrapper.findComponent(GlEmptyState);
const findGlSprintf = () => wrapper.findComponent(GlSprintf);
const factory = () => {
wrapper = shallowMount(NoEnvironmentEmptyState, {
......
......@@ -42,10 +42,10 @@ describe('PolicyRuleBuilder component', () => {
}
const findEndpointLabels = () => wrapper.find("[data-testid='endpoint-labels']");
const findRuleEndpoint = () => wrapper.find(PolicyRuleEndpoint);
const findRuleEntity = () => wrapper.find(PolicyRuleEntity);
const findRuleCIDR = () => wrapper.find(PolicyRuleCIDR);
const findRuleFQDN = () => wrapper.find(PolicyRuleFQDN);
const findRuleEndpoint = () => wrapper.findComponent(PolicyRuleEndpoint);
const findRuleEntity = () => wrapper.findComponent(PolicyRuleEntity);
const findRuleCIDR = () => wrapper.findComponent(PolicyRuleCIDR);
const findRuleFQDN = () => wrapper.findComponent(PolicyRuleFQDN);
const findPorts = () => wrapper.find("[data-testid='ports']");
afterEach(() => {
......
......@@ -22,7 +22,7 @@ describe('PolicyRuleEntity component', () => {
wrapper.destroy();
});
const findDropdown = () => wrapper.find(GlDropdown);
const findDropdown = () => wrapper.findComponent(GlDropdown);
describe("when value has 'all' entity", () => {
beforeEach(() => {
......@@ -31,7 +31,9 @@ describe('PolicyRuleEntity component', () => {
it('selects all items', () => {
const dropdown = findDropdown();
const selectedItems = dropdown.findAll(GlDropdownItem).filter((el) => el.props('isChecked'));
const selectedItems = dropdown
.findAllComponents(GlDropdownItem)
.filter((el) => el.props('isChecked'));
expect(selectedItems.length).toEqual(Object.keys(EntityTypes).length);
expect(dropdown.props('text')).toEqual('All selected');
});
......@@ -48,7 +50,7 @@ describe('PolicyRuleEntity component', () => {
it("emits change with 'all' entity", () => {
const dropdown = findDropdown();
dropdown
.findAll(GlDropdownItem)
.findAllComponents(GlDropdownItem)
.filter((el) => el.text() === EntityTypes.HOST)
.at(0)
.vm.$emit('click');
......
......@@ -46,7 +46,7 @@ describe('StatisticsHistory component', () => {
wrapper.destroy();
});
const findChart = () => wrapper.find(GlAreaChart);
const findChart = () => wrapper.findComponent(GlAreaChart);
describe('the data passed to the chart', () => {
beforeEach(() => {
......
......@@ -11,8 +11,8 @@ describe('StatisticsSummary component', () => {
});
};
const findAnomalousStat = () => wrapper.findAll(GlSingleStat).at(0);
const findNominalStat = () => wrapper.findAll(GlSingleStat).at(1);
const findAnomalousStat = () => wrapper.findAllComponents(GlSingleStat).at(0);
const findNominalStat = () => wrapper.findAllComponents(GlSingleStat).at(1);
beforeEach(() => {
factory({
......
......@@ -33,8 +33,8 @@ describe('ThreatMonitoringFilters component', () => {
});
};
const findEnvironmentsPicker = () => wrapper.find(EnvironmentPicker);
const findShowLastDropdown = () => wrapper.find(DateTimePicker);
const findEnvironmentsPicker = () => wrapper.findComponent(EnvironmentPicker);
const findShowLastDropdown = () => wrapper.findComponent(DateTimePicker);
afterEach(() => {
wrapper.destroy();
......
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