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