Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/pipelines/empty_state_spec.js')
-rw-r--r--spec/frontend/pipelines/empty_state_spec.js58
1 files changed, 41 insertions, 17 deletions
diff --git a/spec/frontend/pipelines/empty_state_spec.js b/spec/frontend/pipelines/empty_state_spec.js
index 3ebedc9ac87..912bc7a104a 100644
--- a/spec/frontend/pipelines/empty_state_spec.js
+++ b/spec/frontend/pipelines/empty_state_spec.js
@@ -1,24 +1,25 @@
-import { shallowMount } from '@vue/test-utils';
+import { mount } from '@vue/test-utils';
import EmptyState from '~/pipelines/components/pipelines_list/empty_state.vue';
describe('Pipelines Empty State', () => {
let wrapper;
- const findGetStartedButton = () => wrapper.find('[data-testid="get-started-pipelines"]');
- const findInfoText = () => wrapper.find('[data-testid="info-text"]').text();
- const createWrapper = () => {
- wrapper = shallowMount(EmptyState, {
+ const findIllustration = () => wrapper.find('img');
+ const findButton = () => wrapper.find('a');
+
+ const createWrapper = (props = {}) => {
+ wrapper = mount(EmptyState, {
propsData: {
- helpPagePath: 'foo',
- emptyStateSvgPath: 'foo',
+ emptyStateSvgPath: 'foo.svg',
canSetCi: true,
+ ...props,
},
});
};
- describe('renders', () => {
+ describe('when user can configure CI', () => {
beforeEach(() => {
- createWrapper();
+ createWrapper({}, mount);
});
afterEach(() => {
@@ -27,26 +28,49 @@ describe('Pipelines Empty State', () => {
});
it('should render empty state SVG', () => {
- expect(wrapper.find('img').attributes('src')).toBe('foo');
+ expect(findIllustration().attributes('src')).toBe('foo.svg');
});
it('should render empty state header', () => {
- expect(wrapper.find('[data-testid="header-text"]').text()).toBe('Build with confidence');
- });
-
- it('should render a link with provided help path', () => {
- expect(findGetStartedButton().attributes('href')).toBe('foo');
+ expect(wrapper.text()).toContain('Build with confidence');
});
it('should render empty state information', () => {
- expect(findInfoText()).toContain(
+ expect(wrapper.text()).toContain(
'GitLab CI/CD can automatically build, test, and deploy your code. Let GitLab take care of time',
'consuming tasks, so you can spend more time creating',
);
});
+ it('should render button with help path', () => {
+ expect(findButton().attributes('href')).toBe('/help/ci/quick_start/index.md');
+ });
+
it('should render button text', () => {
- expect(findGetStartedButton().text()).toBe('Get started with CI/CD');
+ expect(findButton().text()).toBe('Get started with CI/CD');
+ });
+ });
+
+ describe('when user cannot configure CI', () => {
+ beforeEach(() => {
+ createWrapper({ canSetCi: false }, mount);
+ });
+
+ afterEach(() => {
+ wrapper.destroy();
+ wrapper = null;
+ });
+
+ it('should render empty state SVG', () => {
+ expect(findIllustration().attributes('src')).toBe('foo.svg');
+ });
+
+ it('should render empty state header', () => {
+ expect(wrapper.text()).toBe('This project is not currently set up to run pipelines.');
+ });
+
+ it('should not render a link', () => {
+ expect(findButton().exists()).toBe(false);
});
});
});