diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/gl_countdown_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/gl_countdown_spec.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/spec/frontend/vue_shared/components/gl_countdown_spec.js b/spec/frontend/vue_shared/components/gl_countdown_spec.js index 82d18c7fd3f..0d1d42082ab 100644 --- a/spec/frontend/vue_shared/components/gl_countdown_spec.js +++ b/spec/frontend/vue_shared/components/gl_countdown_spec.js @@ -1,4 +1,4 @@ -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import mountComponent from 'helpers/vue_mount_component_helper'; import GlCountdown from '~/vue_shared/components/gl_countdown.vue'; @@ -17,38 +17,34 @@ describe('GlCountdown', () => { }); describe('when there is time remaining', () => { - beforeEach((done) => { + beforeEach(async () => { vm = mountComponent(Component, { endDateString: '2000-01-01T01:02:03Z', }); - Vue.nextTick().then(done).catch(done.fail); + await nextTick(); }); it('displays remaining time', () => { expect(vm.$el.textContent).toContain('01:02:03'); }); - it('updates remaining time', (done) => { + it('updates remaining time', async () => { now = '2000-01-01T00:00:01Z'; jest.advanceTimersByTime(1000); - Vue.nextTick() - .then(() => { - expect(vm.$el.textContent).toContain('01:02:02'); - done(); - }) - .catch(done.fail); + await nextTick(); + expect(vm.$el.textContent).toContain('01:02:02'); }); }); describe('when there is no time remaining', () => { - beforeEach((done) => { + beforeEach(async () => { vm = mountComponent(Component, { endDateString: '1900-01-01T00:00:00Z', }); - Vue.nextTick().then(done).catch(done.fail); + await nextTick(); }); it('displays 00:00:00', () => { |