Commit 3b50eec9 authored by pburdette's avatar pburdette

Refactor artifact spec

Spec now searches for GlLinks
and I added another mock artifact
to props data.
parent 08ff94cd
......@@ -33,7 +33,7 @@ export default {
<i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li v-for="(artifact, i) in artifacts" :key="i" data-testid="artifact">
<li v-for="(artifact, i) in artifacts" :key="i">
<gl-link :href="artifact.path" rel="nofollow" download
>Download {{ artifact.name }} artifacts</gl-link
>
......
......@@ -13,12 +13,17 @@ describe('Pipelines Artifacts dropdown', () => {
name: 'artifact',
path: '/download/path',
},
{
name: 'artifact two',
path: '/download/path-two',
},
],
},
});
};
const findGlLink = () => wrapper.find(GlLink);
const findAllGlLinks = () => wrapper.find('.dropdown-menu').findAll(GlLink);
beforeEach(() => {
createComponent();
......@@ -29,8 +34,8 @@ describe('Pipelines Artifacts dropdown', () => {
wrapper = null;
});
it('should render a dropdown with the provided artifacts', () => {
expect(wrapper.findAll('[data-testid="artifact"]')).toHaveLength(1);
it('should render a dropdown with all the provided artifacts', () => {
expect(findAllGlLinks()).toHaveLength(2);
});
it('should render a link with the provided path', () => {
......
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