diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-25 00:14:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-25 00:14:06 +0300 |
commit | 8e73c80c681d8b02633ae25dbd642ecff4864511 (patch) | |
tree | 5d33c6c8cd78c596f80997864b3558edf430b666 /spec/frontend/packages_and_registries/package_registry/pages | |
parent | fdc98c3e3cfdca66222044fc6aa195011d227ee2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries/package_registry/pages')
-rw-r--r-- | spec/frontend/packages_and_registries/package_registry/pages/list_spec.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js index 2ac2a6455ef..8121d9c7dbd 100644 --- a/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/pages/list_spec.js @@ -85,7 +85,7 @@ describe('PackagesListApp', () => { wrapper.destroy(); }); - const waitForFirstRequest = () => { + const waitForFirstRequest = async () => { // emit a search update so the query is executed findSearch().vm.$emit('update', { sort: 'NAME_DESC', filters: [] }); return waitForPromises(); @@ -149,11 +149,10 @@ describe('PackagesListApp', () => { beforeEach(() => { resolver = jest.fn().mockResolvedValue(packagesListQuery()); mountComponent({ resolver }); - - return waitForFirstRequest(); }); - it('exists and has the right props', () => { + it('exists and has the right props', async () => { + await waitForFirstRequest(); expect(findListComponent().props()).toMatchObject({ list: expect.arrayContaining([expect.objectContaining({ id: packageData().id })]), isLoading: false, @@ -161,16 +160,20 @@ describe('PackagesListApp', () => { }); }); - it('when list emits next-page fetches the next set of records', () => { + it('when list emits next-page fetches the next set of records', async () => { + await waitForFirstRequest(); findListComponent().vm.$emit('next-page'); + await waitForPromises(); expect(resolver).toHaveBeenCalledWith( expect.objectContaining({ after: pagination().endCursor, first: GRAPHQL_PAGE_SIZE }), ); }); - it('when list emits prev-page fetches the prev set of records', () => { + it('when list emits prev-page fetches the prev set of records', async () => { + await waitForFirstRequest(); findListComponent().vm.$emit('prev-page'); + await waitForPromises(); expect(resolver).toHaveBeenCalledWith( expect.objectContaining({ before: pagination().startCursor, last: GRAPHQL_PAGE_SIZE }), |