Commit bbd0ef54 authored by Savas Vedova's avatar Savas Vedova

Apply code review suggestions

parent 8f4f2ff0
...@@ -111,7 +111,12 @@ export default { ...@@ -111,7 +111,12 @@ export default {
<template> <template>
<div> <div>
<gl-alert v-if="errorLoadingFindings" class="mb-4" variant="danger" @dismiss="onErrorDismiss"> <gl-alert
v-if="errorLoadingFindings"
class="gl-mb-6"
variant="danger"
@dismiss="onErrorDismiss"
>
{{ {{
s__( s__(
'SecurityReports|Error fetching the vulnerability list. Please check your network connection and try again.', 'SecurityReports|Error fetching the vulnerability list. Please check your network connection and try again.',
...@@ -127,7 +132,7 @@ export default { ...@@ -127,7 +132,7 @@ export default {
/> />
<gl-intersection-observer <gl-intersection-observer
v-if="pageInfo.hasNextPage" v-if="pageInfo.hasNextPage"
class="text-center" class="gl-text-center"
@appear="fetchNextPage" @appear="fetchNextPage"
> >
<gl-loading-icon v-if="isLoadingQuery" size="md" /> <gl-loading-icon v-if="isLoadingQuery" size="md" />
......
...@@ -39,6 +39,12 @@ describe('Pipeline findings', () => { ...@@ -39,6 +39,12 @@ describe('Pipeline findings', () => {
}); });
}; };
const createWrapperWithApollo = (resolver) => {
return createWrapper({
apolloProvider: createMockApollo([[pipelineFindingsQuery, resolver]]),
});
};
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver); const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findVulnerabilityList = () => wrapper.find(VulnerabilityList); const findVulnerabilityList = () => wrapper.find(VulnerabilityList);
...@@ -61,14 +67,10 @@ describe('Pipeline findings', () => { ...@@ -61,14 +67,10 @@ describe('Pipeline findings', () => {
describe('with findings', () => { describe('with findings', () => {
beforeEach(() => { beforeEach(() => {
createWrapper({ createWrapperWithApollo(jest.fn().mockResolvedValue(mockPipelineFindingsResponse()));
apolloProvider: createMockApollo([
[pipelineFindingsQuery, jest.fn().mockResolvedValue(mockPipelineFindingsResponse())],
]),
});
}); });
it('does not show the loading state', () => { it('passes false as the loading state prop', () => {
expect(findVulnerabilityList().props('isLoading')).toBe(false); expect(findVulnerabilityList().props('isLoading')).toBe(false);
}); });
...@@ -86,14 +88,9 @@ describe('Pipeline findings', () => { ...@@ -86,14 +88,9 @@ describe('Pipeline findings', () => {
describe('with multiple page findings', () => { describe('with multiple page findings', () => {
beforeEach(() => { beforeEach(() => {
createWrapper({ createWrapperWithApollo(
apolloProvider: createMockApollo([ jest.fn().mockResolvedValue(mockPipelineFindingsResponse({ hasNextPage: true })),
[ );
pipelineFindingsQuery,
jest.fn().mockResolvedValue(mockPipelineFindingsResponse({ hasNextPage: true })),
],
]),
});
}); });
it('shows the insersection loader', () => { it('shows the insersection loader', () => {
...@@ -103,11 +100,7 @@ describe('Pipeline findings', () => { ...@@ -103,11 +100,7 @@ describe('Pipeline findings', () => {
describe('with failed query', () => { describe('with failed query', () => {
beforeEach(() => { beforeEach(() => {
createWrapper({ createWrapperWithApollo(jest.fn().mockRejectedValue(new Error('GrahpQL error')));
apolloProvider: createMockApollo([
[pipelineFindingsQuery, jest.fn().mockRejectedValue(new Error('GrahpQL error'))],
]),
});
}); });
it('does not show the vulnerability list', () => { it('does not show the vulnerability list', () => {
......
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