Commit cdf7104d authored by Alexander Turinske's avatar Alexander Turinske

Update agent vulnerability report tests

- add code comment explaining some non-standard code
parent 073f1fe0
...@@ -16,6 +16,13 @@ export default { ...@@ -16,6 +16,13 @@ export default {
VulnerabilityFilters, VulnerabilityFilters,
VulnerabilityListGraphql, VulnerabilityListGraphql,
}, },
/**
* Normally we should only use provide when bootstrapping an application, but this is an exception
* because there is a CE/EE split in `app/assets/javascripts/clusters/agents/index.js` (where
* these values are only needed for EE) and there is necessary rename/variable naming that only
* makes sense in the context of being in the `app/assets/javascripts/security_dashboard`
* directory.
*/
provide() { provide() {
return { return {
dashboardDocumentation: helpPagePath('user/application_security/security_dashboard/index'), dashboardDocumentation: helpPagePath('user/application_security/security_dashboard/index'),
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Agent vulnerability report component renders 1`] = `
<div>
<vulnerability-filters-stub
class="security-dashboard-filters gl-mt-7"
filters="[object Object],[object Object],[object Object]"
/>
<vulnerability-list-graphql-stub
fields="[object Object],[object Object],[object Object],[object Object],,[object Object]"
query="[object Object]"
/>
</div>
`;
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import VulnerabilityListGraphql from 'ee/security_dashboard/components/shared/vulnerability_report/vulnerability_list_graphql.vue';
import VulnerabilityFilters from 'ee/security_dashboard/components/shared/vulnerability_report/vulnerability_filters.vue';
import AgentVulnerabilityReport from 'ee/security_dashboard/components/agent/agent_vulnerability_report.vue'; import AgentVulnerabilityReport from 'ee/security_dashboard/components/agent/agent_vulnerability_report.vue';
describe('Agent vulnerability report component', () => { describe('Agent vulnerability report component', () => {
...@@ -12,9 +10,6 @@ describe('Agent vulnerability report component', () => { ...@@ -12,9 +10,6 @@ describe('Agent vulnerability report component', () => {
wrapper = shallowMount(AgentVulnerabilityReport, { provide }); wrapper = shallowMount(AgentVulnerabilityReport, { provide });
}; };
const findVulnerabilityFilters = () => wrapper.findComponent(VulnerabilityFilters);
const findVulnerabilityList = () => wrapper.findComponent(VulnerabilityListGraphql);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
}); });
...@@ -22,7 +17,6 @@ describe('Agent vulnerability report component', () => { ...@@ -22,7 +17,6 @@ describe('Agent vulnerability report component', () => {
it('renders', () => { it('renders', () => {
createWrapper(); createWrapper();
expect(findVulnerabilityFilters().exists()).toBe(true); expect(wrapper.element).toMatchSnapshot();
expect(findVulnerabilityList().exists()).toBe(true);
}); });
}); });
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