debian-mirror-gitlab/spec/javascripts/jobs/components/job_log_spec.js

66 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-11-20 20:47:30 +05:30
import Vue from 'vue';
2020-01-01 13:55:28 +05:30
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
2018-11-20 20:47:30 +05:30
import component from '~/jobs/components/job_log.vue';
2018-12-13 13:39:08 +05:30
import createStore from '~/jobs/store';
import { resetStore } from '../store/helpers';
2018-11-20 20:47:30 +05:30
describe('Job Log', () => {
const Component = Vue.extend(component);
2018-12-13 13:39:08 +05:30
let store;
2018-11-20 20:47:30 +05:30
let vm;
2018-12-13 13:39:08 +05:30
const trace =
2019-12-21 20:55:43 +05:30
'<span>Running with gitlab-runner 12.1.0 (de7731dd)<br/></span><span> on docker-auto-scale-com d5ae8d25<br/></span><div class="append-right-8" data-timestamp="1565502765" data-section="prepare-executor" role="button"></div><span class="section section-header js-s-prepare-executor">Using Docker executor with image ruby:2.6 ...<br/></span>';
2018-12-13 13:39:08 +05:30
beforeEach(() => {
store = createStore();
});
2018-11-20 20:47:30 +05:30
afterEach(() => {
2018-12-13 13:39:08 +05:30
resetStore(store);
2018-11-20 20:47:30 +05:30
vm.$destroy();
});
it('renders provided trace', () => {
2018-12-13 13:39:08 +05:30
vm = mountComponentWithStore(Component, {
props: {
trace,
isComplete: true,
},
store,
2018-11-20 20:47:30 +05:30
});
2018-12-13 13:39:08 +05:30
expect(vm.$el.querySelector('code').textContent).toContain(
2019-10-12 21:52:04 +05:30
'Running with gitlab-runner 12.1.0 (de7731dd)',
2018-12-13 13:39:08 +05:30
);
2018-11-20 20:47:30 +05:30
});
describe('while receiving trace', () => {
it('renders animation', () => {
2018-12-13 13:39:08 +05:30
vm = mountComponentWithStore(Component, {
props: {
trace,
isComplete: false,
},
store,
2018-11-20 20:47:30 +05:30
});
expect(vm.$el.querySelector('.js-log-animation')).not.toBeNull();
});
});
describe('when build trace has finishes', () => {
it('does not render animation', () => {
2018-12-13 13:39:08 +05:30
vm = mountComponentWithStore(Component, {
props: {
trace,
isComplete: true,
},
store,
2018-11-20 20:47:30 +05:30
});
expect(vm.$el.querySelector('.js-log-animation')).toBeNull();
});
});
});