Commit cc16de42 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'find-migrate-ee-threat-monitoring' into 'master'

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

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