diff options
Diffstat (limited to 'spec/frontend/analytics/usage_trends/components/users_chart_spec.js')
-rw-r--r-- | spec/frontend/analytics/usage_trends/components/users_chart_spec.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/spec/frontend/analytics/usage_trends/components/users_chart_spec.js b/spec/frontend/analytics/usage_trends/components/users_chart_spec.js index 04ea25a02d5..32a664a5026 100644 --- a/spec/frontend/analytics/usage_trends/components/users_chart_spec.js +++ b/spec/frontend/analytics/usage_trends/components/users_chart_spec.js @@ -1,9 +1,10 @@ import { GlAlert } from '@gitlab/ui'; import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; +import waitForPromises from 'helpers/wait_for_promises'; import UsersChart from '~/analytics/usage_trends/components/users_chart.vue'; import usersQuery from '~/analytics/usage_trends/graphql/queries/users.query.graphql'; import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue'; @@ -67,7 +68,7 @@ describe('UsersChart', () => { describe('without data', () => { beforeEach(async () => { wrapper = createComponent({ users: [] }); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('renders an no data message', () => { @@ -86,7 +87,7 @@ describe('UsersChart', () => { describe('with data', () => { beforeEach(async () => { wrapper = createComponent({ users: mockCountsData2 }); - await wrapper.vm.$nextTick(); + await waitForPromises(); }); it('hides the skeleton loader', () => { @@ -107,7 +108,7 @@ describe('UsersChart', () => { describe('with errors', () => { beforeEach(async () => { wrapper = createComponent({ loadingError: true }); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('renders an error message', () => { @@ -134,7 +135,7 @@ describe('UsersChart', () => { }); jest.spyOn(wrapper.vm.$apollo.queries.users, 'fetchMore'); - await wrapper.vm.$nextTick(); + await nextTick(); }); it('requests data twice', () => { @@ -147,7 +148,7 @@ describe('UsersChart', () => { }); describe('when the fetchMore query throws an error', () => { - beforeEach(() => { + beforeEach(async () => { wrapper = createComponent({ users: mockCountsData2, additionalData: mockCountsData1, @@ -156,7 +157,7 @@ describe('UsersChart', () => { jest .spyOn(wrapper.vm.$apollo.queries.users, 'fetchMore') .mockImplementation(jest.fn().mockRejectedValue()); - return wrapper.vm.$nextTick(); + await waitForPromises(); }); it('calls fetchMore', () => { |