Commit 6b7f6a55 authored by Alexander Turinske's avatar Alexander Turinske

Update tests to not hard-code strings

- use mock data for tests
parent 658a2aa2
......@@ -118,23 +118,28 @@ describe('Vulnerability list component', () => {
it('should display the vulnerability locations', () => {
expect(findDataCell(`location-${newVulnerabilities[0].id}`).text()).toContain(
'Administrator / Security reports',
newVulnerabilities[0].project.nameWithNamespace,
);
expect(findDataCell(`location-${newVulnerabilities[0].id}`).text()).toContain(
'registry.gitlab.com/groulot/container-scanning-test/master:5f21de6956aee99ddb68ae49498662d9872f50ff',
newVulnerabilities[0].location.image,
);
expect(findDataCell(`location-${newVulnerabilities[0].id}`).text()).not.toContain('(line: ');
expect(findDataCell(`location-${newVulnerabilities[1].id}`).text()).toContain(
'Administrator / Vulnerability reports',
newVulnerabilities[1].project.nameWithNamespace,
);
expect(findDataCell(`location-${newVulnerabilities[1].id}`).text()).toContain(
'src/main/java/com/gitlab/security_products/tests/App.java (line: 1337)',
newVulnerabilities[1].location.file,
);
expect(findDataCell(`location-${newVulnerabilities[1].id}`).text()).toContain(
newVulnerabilities[1].location.startLine,
);
expect(findDataCell(`location-${newVulnerabilities[2].id}`).text()).toContain(
'Mixed Vulnerabilities / Dependency List Test 01',
newVulnerabilities[2].project.nameWithNamespace,
);
expect(findDataCell(`location-${newVulnerabilities[2].id}`).text()).toContain(
'src/main/java/com/gitlab/security_products/tests/App.java',
newVulnerabilities[2].location.file,
);
expect(findDataCell(`location-${newVulnerabilities[2].id}`).text()).not.toContain('(line: ');
});
it('should not display the vulnerability report type', () => {
......
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