Commit 0cccf8e1 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch '324421-reduce-graphql-complexity' into 'master'

Refactor On-call schedule schedule call to reduce complexity

See merge request gitlab-org/gitlab!59510
parents ac178f16 1ee24710
#import "../fragments/oncall_schedule_rotation.fragment.graphql"
query getOncallSchedulesWithRotations($projectPath: ID!) {
project(fullPath: $projectPath) {
incidentManagementOncallSchedules {
......@@ -10,7 +8,7 @@ query getOncallSchedulesWithRotations($projectPath: ID!) {
timezone
rotations {
nodes {
...OnCallRotation
id
}
}
}
......
......@@ -62,7 +62,7 @@ describe('AddScheduleModal', () => {
}
async function updateSchedule(localWrapper) {
localWrapper.find(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
localWrapper.findComponent(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
}
const createComponentWithApollo = ({
......@@ -111,11 +111,10 @@ describe('AddScheduleModal', () => {
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
const findModal = () => wrapper.find(GlModal);
const findAlert = () => wrapper.find(GlAlert);
const findModal = () => wrapper.findComponent(GlModal);
const findAlert = () => wrapper.findComponent(GlAlert);
describe('Schedule create', () => {
beforeEach(() => {
......
......@@ -27,9 +27,9 @@ describe('DeleteScheduleModal', () => {
let fakeApollo;
let destroyScheduleHandler;
const findModal = () => wrapper.find(GlModal);
const findModalText = () => wrapper.find(GlSprintf);
const findAlert = () => wrapper.find(GlAlert);
const findModal = () => wrapper.findComponent(GlModal);
const findModalText = () => wrapper.findComponent(GlSprintf);
const findAlert = () => wrapper.findComponent(GlAlert);
async function awaitApolloDomMock() {
await wrapper.vm.$nextTick(); // kick off the DOM update
......@@ -38,7 +38,7 @@ describe('DeleteScheduleModal', () => {
}
async function destroySchedule(localWrapper) {
localWrapper.find(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
localWrapper.findComponent(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
}
const createComponent = ({ data = {}, props = {} } = {}) => {
......
......@@ -66,15 +66,14 @@ describe('On-call schedule wrapper', () => {
afterEach(() => {
if (wrapper) {
wrapper.destroy();
wrapper = null;
}
});
const findLoader = () => wrapper.find(GlLoadingIcon);
const findEmptyState = () => wrapper.find(GlEmptyState);
const findSchedule = () => wrapper.find(OnCallSchedule);
const findAlert = () => wrapper.find(GlAlert);
const findModal = () => wrapper.find(AddScheduleModal);
const findLoader = () => wrapper.findComponent(GlLoadingIcon);
const findEmptyState = () => wrapper.findComponent(GlEmptyState);
const findSchedule = () => wrapper.findComponent(OnCallSchedule);
const findAlert = () => wrapper.findComponent(GlAlert);
const findModal = () => wrapper.findComponent(AddScheduleModal);
it('shows a loader while data is requested', () => {
mountComponent({ loading: true });
......
......@@ -42,7 +42,7 @@ describe('AddEditRotationModal', () => {
}
async function createRotation(localWrapper) {
localWrapper.find(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
localWrapper.findComponent(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
}
const createComponent = ({ data = {}, props = {}, loading = false } = {}) => {
......
......@@ -28,9 +28,9 @@ describe('DeleteRotationModal', () => {
let fakeApollo;
let destroyRotationHandler;
const findModal = () => wrapper.find(GlModal);
const findModalText = () => wrapper.find(GlSprintf);
const findAlert = () => wrapper.find(GlAlert);
const findModal = () => wrapper.findComponent(GlModal);
const findModalText = () => wrapper.findComponent(GlSprintf);
const findAlert = () => wrapper.findComponent(GlAlert);
async function awaitApolloDomMock() {
await wrapper.vm.$nextTick(); // kick off the DOM update
......@@ -39,7 +39,7 @@ describe('DeleteRotationModal', () => {
}
async function destroyRotation(localWrapper) {
localWrapper.find(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
localWrapper.findComponent(GlModal).vm.$emit('primary', { preventDefault: jest.fn() });
}
const createComponent = ({ data = {}, props = {} } = {}) => {
......@@ -109,7 +109,6 @@ describe('DeleteRotationModal', () => {
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
it('renders delete rotation modal layout', () => {
......
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