Commit fc77acc2 authored by Mark Florian's avatar Mark Florian Committed by Kushal Pandya

Remove setImmediate usage in specs

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/344247.
parent 33c3e20e
...@@ -158,19 +158,17 @@ describe('ee merge request widget options', () => { ...@@ -158,19 +158,17 @@ describe('ee merge request widget options', () => {
mock.onGet(SAST_DIFF_ENDPOINT).reply(200, sastDiffSuccessMock); mock.onGet(SAST_DIFF_ENDPOINT).reply(200, sastDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${SAST_SELECTOR} .report-block-list-issue-description`)
.find(`${SAST_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual('SAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others');
).toEqual('SAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others');
done();
});
}); });
}); });
...@@ -180,19 +178,17 @@ describe('ee merge request widget options', () => { ...@@ -180,19 +178,17 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${SAST_SELECTOR} .report-block-list-issue-description`)
.find(`${SAST_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual('SAST detected no vulnerabilities.');
).toEqual('SAST detected no vulnerabilities.');
done();
});
}); });
}); });
...@@ -202,15 +198,13 @@ describe('ee merge request widget options', () => { ...@@ -202,15 +198,13 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(trimText(findExtendedSecurityWidget().find(SAST_SELECTOR).text())).toContain(
expect(trimText(findExtendedSecurityWidget().find(SAST_SELECTOR).text())).toContain( 'SAST: Loading resulted in an error',
'SAST: Loading resulted in an error', );
);
done();
});
}); });
}); });
...@@ -269,21 +263,19 @@ describe('ee merge request widget options', () => { ...@@ -269,21 +263,19 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`)
.find(`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual(
).toEqual( 'Dependency scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'Dependency scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others', );
);
done();
});
}); });
}); });
...@@ -297,19 +289,17 @@ describe('ee merge request widget options', () => { ...@@ -297,19 +289,17 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('renders no vulnerabilities message', (done) => { it('renders no vulnerabilities message', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`)
.find(`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual('Dependency scanning detected no vulnerabilities.');
).toEqual('Dependency scanning detected no vulnerabilities.');
done();
});
}); });
}); });
...@@ -319,19 +309,17 @@ describe('ee merge request widget options', () => { ...@@ -319,19 +309,17 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`)
.find(`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual('Dependency scanning detected no vulnerabilities.');
).toEqual('Dependency scanning detected no vulnerabilities.');
done();
});
}); });
}); });
...@@ -340,15 +328,13 @@ describe('ee merge request widget options', () => { ...@@ -340,15 +328,13 @@ describe('ee merge request widget options', () => {
mock.onAny().reply(500); mock.onAny().reply(500);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(
expect( trimText(findExtendedSecurityWidget().find(DEPENDENCY_SCANNING_SELECTOR).text()),
trimText(findExtendedSecurityWidget().find(DEPENDENCY_SCANNING_SELECTOR).text()), ).toContain('Dependency scanning: Loading resulted in an error');
).toContain('Dependency scanning: Loading resulted in an error');
done();
});
}); });
}); });
}); });
...@@ -362,60 +348,47 @@ describe('ee merge request widget options', () => { ...@@ -362,60 +348,47 @@ describe('ee merge request widget options', () => {
}); });
describe('with successful request', () => { describe('with successful request', () => {
beforeEach(async () => { beforeEach(() => {
mock.onGet(DEFAULT_BROWSER_PERFORMANCE.head_path).reply(200, headBrowserPerformance); mock.onGet(DEFAULT_BROWSER_PERFORMANCE.head_path).reply(200, headBrowserPerformance);
mock.onGet(DEFAULT_BROWSER_PERFORMANCE.base_path).reply(200, baseBrowserPerformance); mock.onGet(DEFAULT_BROWSER_PERFORMANCE.base_path).reply(200, baseBrowserPerformance);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
await waitForPromises();
}); });
describe('default', () => { describe('default', () => {
beforeEach(() => { beforeEach(() => {
setBrowserPerformance(); setBrowserPerformance();
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()),
trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()), ).toEqual('Browser performance test metrics: 2 degraded, 1 same, 1 improved');
).toEqual('Browser performance test metrics: 2 degraded, 1 same, 1 improved');
done();
});
}); });
it('should render performance issue body component', (done) => { it('should render performance issue body component', () => {
setImmediate(() => { expect(wrapper.findComponent(PerformanceIssueBody).exists()).toBe(true);
expect(wrapper.findComponent(PerformanceIssueBody).exists()).toBe(true);
done();
});
}); });
describe('text connector', () => { describe('text connector', () => {
it('should only render information about fixed issues', (done) => { it('should only render information about fixed issues', async () => {
setImmediate(async () => { wrapper.vm.mr.browserPerformanceMetrics.degraded = [];
wrapper.vm.mr.browserPerformanceMetrics.degraded = []; wrapper.vm.mr.browserPerformanceMetrics.same = [];
wrapper.vm.mr.browserPerformanceMetrics.same = [];
await nextTick();
await nextTick(); expect(
expect( trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()),
trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()), ).toEqual('Browser performance test metrics: 1 improved');
).toEqual('Browser performance test metrics: 1 improved');
done();
});
}); });
it('should only render information about added issues', (done) => { it('should only render information about added issues', async () => {
setImmediate(async () => { wrapper.vm.mr.browserPerformanceMetrics.improved = [];
wrapper.vm.mr.browserPerformanceMetrics.improved = []; wrapper.vm.mr.browserPerformanceMetrics.same = [];
wrapper.vm.mr.browserPerformanceMetrics.same = [];
await nextTick(); await nextTick();
expect( expect(
trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()), trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()),
).toEqual('Browser performance test metrics: 2 degraded'); ).toEqual('Browser performance test metrics: 2 degraded');
done();
});
}); });
}); });
}); });
...@@ -447,7 +420,7 @@ describe('ee merge request widget options', () => { ...@@ -447,7 +420,7 @@ describe('ee merge request widget options', () => {
}); });
describe('with empty successful request', () => { describe('with empty successful request', () => {
beforeEach((done) => { beforeEach(() => {
mock.onGet(DEFAULT_BROWSER_PERFORMANCE.head_path).reply(200, []); mock.onGet(DEFAULT_BROWSER_PERFORMANCE.head_path).reply(200, []);
mock.onGet(DEFAULT_BROWSER_PERFORMANCE.base_path).reply(200, []); mock.onGet(DEFAULT_BROWSER_PERFORMANCE.base_path).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
...@@ -456,7 +429,7 @@ describe('ee merge request widget options', () => { ...@@ -456,7 +429,7 @@ describe('ee merge request widget options', () => {
wrapper.vm.mr.browserPerformance = gl.mrWidgetData.browserPerformance; wrapper.vm.mr.browserPerformance = gl.mrWidgetData.browserPerformance;
// wait for network request from component watch update method // wait for network request from component watch update method
setImmediate(done); return axios.waitForAll();
}); });
it('should render provided data', () => { it('should render provided data', () => {
...@@ -486,15 +459,13 @@ describe('ee merge request widget options', () => { ...@@ -486,15 +459,13 @@ describe('ee merge request widget options', () => {
gl.mrWidgetData.browserPerformance = { ...DEFAULT_BROWSER_PERFORMANCE }; gl.mrWidgetData.browserPerformance = { ...DEFAULT_BROWSER_PERFORMANCE };
wrapper.vm.mr.browserPerformance = gl.mrWidgetData.browserPerformance; wrapper.vm.mr.browserPerformance = gl.mrWidgetData.browserPerformance;
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(
expect( trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()),
trimText(wrapper.find('.js-browser-performance-widget .js-code-text').text()), ).toContain('Failed to load browser-performance report');
).toContain('Failed to load browser-performance report');
done();
});
}); });
}); });
}); });
...@@ -517,11 +488,11 @@ describe('ee merge request widget options', () => { ...@@ -517,11 +488,11 @@ describe('ee merge request widget options', () => {
}); });
describe('default', () => { describe('default', () => {
beforeEach((done) => { beforeEach(() => {
setLoadPerformance(); setLoadPerformance();
// wait for network request from component watch update method // wait for network request from component watch update method
setImmediate(done); return axios.waitForAll();
}); });
it('should render provided data', () => { it('should render provided data', () => {
...@@ -559,7 +530,7 @@ describe('ee merge request widget options', () => { ...@@ -559,7 +530,7 @@ describe('ee merge request widget options', () => {
}); });
describe('with empty successful request', () => { describe('with empty successful request', () => {
beforeEach((done) => { beforeEach(() => {
mock.onGet(DEFAULT_LOAD_PERFORMANCE.head_path).reply(200, {}); mock.onGet(DEFAULT_LOAD_PERFORMANCE.head_path).reply(200, {});
mock.onGet(DEFAULT_LOAD_PERFORMANCE.base_path).reply(200, {}); mock.onGet(DEFAULT_LOAD_PERFORMANCE.base_path).reply(200, {});
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
...@@ -568,7 +539,7 @@ describe('ee merge request widget options', () => { ...@@ -568,7 +539,7 @@ describe('ee merge request widget options', () => {
wrapper.vm.mr.loadPerformance = gl.mrWidgetData.loadPerformance; wrapper.vm.mr.loadPerformance = gl.mrWidgetData.loadPerformance;
// wait for network request from component watch update method // wait for network request from component watch update method
setImmediate(done); return axios.waitForAll();
}); });
it('should render provided data', () => { it('should render provided data', () => {
...@@ -598,15 +569,14 @@ describe('ee merge request widget options', () => { ...@@ -598,15 +569,14 @@ describe('ee merge request widget options', () => {
gl.mrWidgetData.loadPerformance = { ...DEFAULT_LOAD_PERFORMANCE }; gl.mrWidgetData.loadPerformance = { ...DEFAULT_LOAD_PERFORMANCE };
wrapper.vm.mr.loadPerformance = gl.mrWidgetData.loadPerformance; wrapper.vm.mr.loadPerformance = gl.mrWidgetData.loadPerformance;
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(
expect( trimText(wrapper.find('.js-load-performance-widget .js-code-text').text()),
trimText(wrapper.find('.js-load-performance-widget .js-code-text').text()), ).toContain('Failed to load load-performance report');
).toContain('Failed to load load-performance report');
done();
});
}); });
}); });
}); });
...@@ -647,21 +617,19 @@ describe('ee merge request widget options', () => { ...@@ -647,21 +617,19 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${CONTAINER_SCANNING_SELECTOR} .report-block-list-issue-description`)
.find(`${CONTAINER_SCANNING_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual(
).toEqual( 'Container scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'Container scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others', );
);
done();
});
}); });
}); });
...@@ -671,15 +639,13 @@ describe('ee merge request widget options', () => { ...@@ -671,15 +639,13 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(findExtendedSecurityWidget().find(CONTAINER_SCANNING_SELECTOR).text()).toContain(
expect(findExtendedSecurityWidget().find(CONTAINER_SCANNING_SELECTOR).text()).toContain( 'Container scanning: Loading resulted in an error',
'Container scanning: Loading resulted in an error', );
);
done();
});
}); });
}); });
}); });
...@@ -720,19 +686,17 @@ describe('ee merge request widget options', () => { ...@@ -720,19 +686,17 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${DAST_SELECTOR} .report-block-list-issue-description`)
.find(`${DAST_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual('DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others');
).toEqual('DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others');
done();
});
}); });
}); });
...@@ -742,15 +706,13 @@ describe('ee merge request widget options', () => { ...@@ -742,15 +706,13 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {}); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {});
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(findExtendedSecurityWidget().find(DAST_SELECTOR).text()).toContain(
expect(findExtendedSecurityWidget().find(DAST_SELECTOR).text()).toContain( 'DAST: Loading resulted in an error',
'DAST: Loading resulted in an error', );
);
done();
});
}); });
}); });
}); });
...@@ -796,21 +758,19 @@ describe('ee merge request widget options', () => { ...@@ -796,21 +758,19 @@ describe('ee merge request widget options', () => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock); mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponentWithFeatureFlag(); createComponentWithFeatureFlag();
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${COVERAGE_FUZZING_SELECTOR} .report-block-list-issue-description`)
.find(`${COVERAGE_FUZZING_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual(
).toEqual( 'Coverage fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'Coverage fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others', );
);
done();
});
}); });
}); });
...@@ -819,15 +779,13 @@ describe('ee merge request widget options', () => { ...@@ -819,15 +779,13 @@ describe('ee merge request widget options', () => {
mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(500, {}); mock.onGet(COVERAGE_FUZZING_ENDPOINT).reply(500, {});
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {}); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, {});
createComponentWithFeatureFlag(); createComponentWithFeatureFlag();
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(findExtendedSecurityWidget().find(COVERAGE_FUZZING_SELECTOR).text()).toContain(
expect(findExtendedSecurityWidget().find(COVERAGE_FUZZING_SELECTOR).text()).toContain( 'Coverage fuzzing: Loading resulted in an error',
'Coverage fuzzing: Loading resulted in an error', );
);
done();
});
}); });
}); });
}); });
...@@ -869,21 +827,19 @@ describe('ee merge request widget options', () => { ...@@ -869,21 +827,19 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${SECRET_DETECTION_SELECTOR} .report-block-list-issue-description`)
.find(`${SECRET_DETECTION_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual(
).toEqual( 'Secret detection detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'Secret detection detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others', );
);
done();
});
}); });
}); });
...@@ -893,15 +849,13 @@ describe('ee merge request widget options', () => { ...@@ -893,15 +849,13 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(findExtendedSecurityWidget().find(SECRET_DETECTION_SELECTOR).text()).toContain(
expect(findExtendedSecurityWidget().find(SECRET_DETECTION_SELECTOR).text()).toContain( 'Secret detection: Loading resulted in an error',
'Secret detection: Loading resulted in an error', );
);
done();
});
}); });
}); });
}); });
...@@ -940,21 +894,19 @@ describe('ee merge request widget options', () => { ...@@ -940,21 +894,19 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render provided data', (done) => { it('should render provided data', () => {
setImmediate(() => { expect(
expect( trimText(
trimText( findExtendedSecurityWidget()
findExtendedSecurityWidget() .find(`${API_FUZZING_SELECTOR} .report-block-list-issue-description`)
.find(`${API_FUZZING_SELECTOR} .report-block-list-issue-description`) .text(),
.text(), ),
), ).toEqual(
).toEqual( 'API fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'API fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others', );
);
done();
});
}); });
}); });
...@@ -964,15 +916,13 @@ describe('ee merge request widget options', () => { ...@@ -964,15 +916,13 @@ describe('ee merge request widget options', () => {
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []); mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } }); createComponent({ propsData: { mrData: gl.mrWidgetData } });
return axios.waitForAll();
}); });
it('should render error indicator', (done) => { it('should render error indicator', () => {
setImmediate(() => { expect(findExtendedSecurityWidget().find(API_FUZZING_SELECTOR).text()).toContain(
expect(findExtendedSecurityWidget().find(API_FUZZING_SELECTOR).text()).toContain( 'API fuzzing: Loading resulted in an error',
'API fuzzing: Loading resulted in an error', );
);
done();
});
}); });
}); });
}); });
......
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