2022-11-25 23:54:43 +05:30
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
import { GlButton } from '@gitlab/ui';
|
|
|
|
|
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 job = jobs[0];
|
2022-11-25 23:54:43 +05:30
|
|
|
let wrapper;
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
beforeEach(() => {
|
2022-11-25 23:54:43 +05:30
|
|
|
wrapper = mount(JobItem, { propsData: { job } });
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders job details', () => {
|
2022-11-25 23:54:43 +05:30
|
|
|
expect(wrapper.text()).toContain(job.name);
|
|
|
|
expect(wrapper.text()).toContain(`#${job.id}`);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('renders CI icon', () => {
|
2022-11-25 23:54:43 +05:30
|
|
|
expect(wrapper.find('[data-testid="status_success_borderless-icon"]').exists()).toBe(true);
|
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 () => {
|
2022-11-25 23:54:43 +05:30
|
|
|
await wrapper.setProps({
|
|
|
|
job: {
|
|
|
|
...jobs[0],
|
|
|
|
started: false,
|
|
|
|
},
|
|
|
|
});
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
expect(wrapper.findComponent(GlButton).exists()).toBe(false);
|
2018-11-08 19:23:39 +05:30
|
|
|
});
|
|
|
|
});
|