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/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js')
-rw-r--r--spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js b/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js
new file mode 100644
index 00000000000..8a4f07c4d88
--- /dev/null
+++ b/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js
@@ -0,0 +1,47 @@
+import { getByRole } from '@testing-library/dom';
+import { mount } from '@vue/test-utils';
+import FirstPipelineCard from '~/pipeline_editor/components/drawer/cards/first_pipeline_card.vue';
+import PipelineVisualReference from '~/pipeline_editor/components/drawer/ui/pipeline_visual_reference.vue';
+
+describe('First pipeline card', () => {
+ let wrapper;
+
+ const defaultProvide = {
+ ciExamplesHelpPagePath: '/pipelines/examples',
+ runnerHelpPagePath: '/help/runners',
+ };
+
+ const createComponent = () => {
+ wrapper = mount(FirstPipelineCard, {
+ provide: {
+ ...defaultProvide,
+ },
+ });
+ };
+
+ const getLinkByName = (name) => getByRole(wrapper.element, 'link', { name }).href;
+ const findPipelinesLink = () => getLinkByName(/examples and templates/i);
+ const findRunnersLink = () => getLinkByName(/make sure your instance has runners available/i);
+ const findVisualReference = () => wrapper.findComponent(PipelineVisualReference);
+
+ beforeEach(() => {
+ createComponent();
+ });
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('renders the title', () => {
+ expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.title);
+ });
+
+ it('renders the content', () => {
+ expect(findVisualReference().exists()).toBe(true);
+ });
+
+ it('renders the links', () => {
+ expect(findRunnersLink()).toContain(defaultProvide.runnerHelpPagePath);
+ expect(findPipelinesLink()).toContain(defaultProvide.ciExamplesHelpPagePath);
+ });
+});