blob: e9119b736c2587e6e49b652629410aad2666188f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import PublishMethod from '~/packages_and_registries/package_registry/components/list/publish_method.vue';
import { packagePipelines } from '../../mock_data';
const [pipelineData] = packagePipelines();
describe('publish_method', () => {
let wrapper;
const findPipelineRef = () => wrapper.findByTestId('pipeline-ref');
const findPipelineSha = () => wrapper.findByTestId('pipeline-sha');
const findManualPublish = () => wrapper.findByTestId('manually-published');
const mountComponent = (pipeline = pipelineData) => {
wrapper = shallowMountExtended(PublishMethod, {
propsData: {
pipeline,
},
});
};
it('renders', () => {
mountComponent();
expect(wrapper.element).toMatchSnapshot();
});
describe('pipeline information', () => {
it('displays branch and commit when pipeline info exists', () => {
mountComponent();
expect(findPipelineRef().exists()).toBe(true);
expect(findPipelineSha().exists()).toBe(true);
});
it('does not show any pipeline details when no information exists', () => {
mountComponent(null);
expect(findPipelineRef().exists()).toBe(false);
expect(findPipelineSha().exists()).toBe(false);
expect(findManualPublish().text()).toBe(PublishMethod.i18n.MANUALLY_PUBLISHED);
});
});
});
|