debian-mirror-gitlab/spec/frontend/ide/components/jobs/item_spec.js

37 lines
909 B
JavaScript
Raw Normal View History

2022-04-04 11:22:00 +05:30
import Vue, { nextTick } from 'vue';
2021-03-08 18:12:59 +05:30
import mountComponent from 'helpers/vue_mount_component_helper';
2018-11-08 19:23:39 +05:30
import JobItem from '~/ide/components/jobs/item.vue';
import { jobs } from '../../mock_data';
describe('IDE jobs item', () => {
const Component = Vue.extend(JobItem);
const job = jobs[0];
let vm;
beforeEach(() => {
vm = mountComponent(Component, {
job,
});
});
afterEach(() => {
vm.$destroy();
});
it('renders job details', () => {
expect(vm.$el.textContent).toContain(job.name);
expect(vm.$el.textContent).toContain(`#${job.id}`);
});
it('renders CI icon', () => {
2020-11-24 15:15:51 +05:30
expect(vm.$el.querySelector('[data-testid="status_success_borderless-icon"]')).not.toBe(null);
2018-11-08 19:23:39 +05:30
});
2022-04-04 11:22:00 +05:30
it('does not render view logs button if not started', async () => {
2018-11-08 19:23:39 +05:30
vm.job.started = false;
2022-04-04 11:22:00 +05:30
await nextTick();
expect(vm.$el.querySelector('.btn')).toBe(null);
2018-11-08 19:23:39 +05:30
});
});