diff options
Diffstat (limited to 'spec/frontend/jobs/components/job_app_spec.js')
-rw-r--r-- | spec/frontend/jobs/components/job_app_spec.js | 148 |
1 files changed, 24 insertions, 124 deletions
diff --git a/spec/frontend/jobs/components/job_app_spec.js b/spec/frontend/jobs/components/job_app_spec.js index 8fa289bbe4d..d0b3d4f6247 100644 --- a/spec/frontend/jobs/components/job_app_spec.js +++ b/spec/frontend/jobs/components/job_app_spec.js @@ -6,6 +6,7 @@ import axios from '~/lib/utils/axios_utils'; import JobApp from '~/jobs/components/job_app.vue'; import createStore from '~/jobs/store'; import job from '../mock_data'; +import { TEST_HOST } from 'jest/helpers/test_constants'; describe('Job App', () => { const localVue = createLocalVue(); @@ -18,8 +19,8 @@ describe('Job App', () => { let mock; const initSettings = { - endpoint: `${gl.TEST_HOST}jobs/123.json`, - pagePath: `${gl.TEST_HOST}jobs/123`, + endpoint: `${TEST_HOST}jobs/123.json`, + pagePath: `${TEST_HOST}jobs/123`, logState: 'eyJvZmZzZXQiOjE3NDUxLCJuX29wZW5fdGFncyI6MCwiZmdfY29sb3IiOm51bGwsImJnX2NvbG9yIjpudWxsLCJzdHlsZV9tYXNrIjowfQ%3D%3D', }; @@ -397,132 +398,31 @@ describe('Job App', () => { }); }); - describe('trace output', () => { - describe('with append flag', () => { - it('appends the log content to the existing one', () => - setupAndMount({ - traceData: { - html: '<span>More<span>', - status: 'running', - state: 'newstate', - append: true, - complete: true, - }, - }) - .then(() => { - store.state.trace = 'Update'; - - return wrapper.vm.$nextTick(); - }) - .then(() => { - expect( - wrapper - .find('.js-build-trace') - .text() - .trim(), - ).toEqual('Update'); - })); + describe('trace controls', () => { + beforeEach(() => + setupAndMount({ + traceData: { + html: '<span>Update</span>', + status: 'success', + append: false, + size: 50, + total: 100, + complete: true, + }, + }), + ); + + it('should render scroll buttons', () => { + expect(wrapper.find('.js-scroll-top').exists()).toBe(true); + expect(wrapper.find('.js-scroll-bottom').exists()).toBe(true); }); - describe('without append flag', () => { - it('replaces the trace', () => - setupAndMount({ - traceData: { - html: '<span>Different<span>', - status: 'running', - append: false, - complete: true, - }, - }).then(() => { - expect( - wrapper - .find('.js-build-trace') - .text() - .trim(), - ).toEqual('Different'); - })); - }); - - describe('truncated information', () => { - describe('when size is less than total', () => { - it('shows information about truncated log', () => { - mock.onGet(`${props.pagePath}/trace.json`).reply(200, { - html: '<span>Update</span>', - status: 'success', - append: false, - size: 50, - total: 100, - complete: true, - }); - - return setupAndMount({ - traceData: { - html: '<span>Update</span>', - status: 'success', - append: false, - size: 50, - total: 100, - complete: true, - }, - }).then(() => { - expect( - wrapper - .find('.js-truncated-info') - .text() - .trim(), - ).toContain('Showing last 50 bytes'); - }); - }); - }); - - describe('when size is equal than total', () => { - it('does not show the truncated information', () => - setupAndMount({ - traceData: { - html: '<span>Update</span>', - status: 'success', - append: false, - size: 100, - total: 100, - complete: true, - }, - }).then(() => { - expect( - wrapper - .find('.js-truncated-info') - .text() - .trim(), - ).toEqual(''); - })); - }); + it('should render link to raw ouput', () => { + expect(wrapper.find('.js-raw-link-controller').exists()).toBe(true); }); - describe('trace controls', () => { - beforeEach(() => - setupAndMount({ - traceData: { - html: '<span>Update</span>', - status: 'success', - append: false, - size: 50, - total: 100, - complete: true, - }, - }), - ); - - it('should render scroll buttons', () => { - expect(wrapper.find('.js-scroll-top').exists()).toBe(true); - expect(wrapper.find('.js-scroll-bottom').exists()).toBe(true); - }); - - it('should render link to raw ouput', () => { - expect(wrapper.find('.js-raw-link-controller').exists()).toBe(true); - }); - - it('should render link to erase job', () => { - expect(wrapper.find('.js-erase-link').exists()).toBe(true); - }); + it('should render link to erase job', () => { + expect(wrapper.find('.js-erase-link').exists()).toBe(true); }); }); }); |