diff options
Diffstat (limited to 'spec/frontend/releases/components/app_index_apollo_client_spec.js')
-rw-r--r-- | spec/frontend/releases/components/app_index_apollo_client_spec.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/frontend/releases/components/app_index_apollo_client_spec.js b/spec/frontend/releases/components/app_index_apollo_client_spec.js index 32bbfd386f5..9881ef9bc9f 100644 --- a/spec/frontend/releases/components/app_index_apollo_client_spec.js +++ b/spec/frontend/releases/components/app_index_apollo_client_spec.js @@ -1,9 +1,10 @@ import { cloneDeep } from 'lodash'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import originalAllReleasesQueryResponse from 'test_fixtures/graphql/releases/graphql/queries/all_releases.query.graphql.json'; import createMockApollo from 'helpers/mock_apollo_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import waitForPromises from 'helpers/wait_for_promises'; import allReleasesQuery from 'shared_queries/releases/all_releases.query.graphql'; import createFlash from '~/flash'; import { historyPushState } from '~/lib/utils/common_utils'; @@ -141,7 +142,8 @@ describe('app_index_apollo_client.vue', () => { }); }); - it(`${toDescription(loadingIndicator)} render a loading indicator`, () => { + it(`${toDescription(loadingIndicator)} render a loading indicator`, async () => { + await waitForPromises(); expect(findLoadingIndicator().exists()).toBe(loadingIndicator); }); @@ -294,7 +296,7 @@ describe('app_index_apollo_client.vue', () => { mockQueryParams = { after }; findPagination().vm.$emit('next', after); - await wrapper.vm.$nextTick(); + await nextTick(); expect(queryMock.mock.calls).toEqual([ [expect.objectContaining({ before })], @@ -319,7 +321,7 @@ describe('app_index_apollo_client.vue', () => { it('requeries the GraphQL endpoint and updates the URL when the sort is changed', async () => { findSort().vm.$emit('input', CREATED_ASC); - await wrapper.vm.$nextTick(); + await nextTick(); expect(queryMock.mock.calls).toEqual([ [expect.objectContaining({ sort: DEFAULT_SORT })], @@ -335,7 +337,7 @@ describe('app_index_apollo_client.vue', () => { it('does not requery the GraphQL endpoint or update the URL if the sort is updated to the same value', async () => { findSort().vm.$emit('input', DEFAULT_SORT); - await wrapper.vm.$nextTick(); + await nextTick(); expect(queryMock.mock.calls).toEqual([ [expect.objectContaining({ sort: DEFAULT_SORT })], @@ -368,7 +370,7 @@ describe('app_index_apollo_client.vue', () => { findSort().vm.$emit('input', CREATED_ASC); - await wrapper.vm.$nextTick(); + await nextTick(); }); it(`resets the page's "${paramName}" pagination cursor when the sort is changed`, () => { |