diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-10-26 11:03:42 +0200 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2018-11-07 10:00:25 +0100 |
commit | ff72bba12cf00c6f929546cfc48293b31c1210bb (patch) | |
tree | 0a00d575671b8721b85ce4911676daefdab8bd45 /spec/javascripts | |
parent | 74f22d26a93a1d4088b7cc4cc7359ef5d956889e (diff) | |
download | gitlab-ce-ff72bba12cf00c6f929546cfc48293b31c1210bb.tar.gz |
Add dynamic timer for delayed jobs on single job page
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/jobs/components/job_app_spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/javascripts/jobs/components/job_app_spec.js b/spec/javascripts/jobs/components/job_app_spec.js index ba1889c4dcd..ba69554012e 100644 --- a/spec/javascripts/jobs/components/job_app_spec.js +++ b/spec/javascripts/jobs/components/job_app_spec.js @@ -8,6 +8,7 @@ import { resetStore } from '../store/helpers'; import job from '../mock_data'; describe('Job App ', () => { + const delayedJobFixture = getJSONFixture('jobs/delayed.json'); const Component = Vue.extend(jobApp); let store; let vm; @@ -420,6 +421,34 @@ describe('Job App ', () => { done(); }, 0); }); + + it('displays remaining time for a delayed job', (done) => { + const oneHourInMilliseconds = 3600000; + spyOn(Date, 'now').and.callFake(() => new Date(delayedJobFixture.scheduled_at).getTime() - oneHourInMilliseconds); + mock.onGet(props.endpoint).replyOnce(200, { ... delayedJobFixture }); + + vm = mountComponentWithStore(Component, { + props, + store, + }); + + store.subscribeAction((action) => { + if (action.type !== 'receiveJobSuccess') { + return; + } + + Vue.nextTick() + .then(() => { + expect(vm.$el.querySelector('.js-job-empty-state')).not.toBeNull(); + + const title = vm.$el.querySelector('.js-job-empty-state-title'); + + expect(title).toContainText('01:00:00'); + done(); + }) + .catch(done.fail); + }); + }); }); }); |