diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-13 03:10:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-13 03:10:23 +0300 |
commit | 5cf4cf3425de200493ba6a48802bf9965723010c (patch) | |
tree | 8924dbf7f49eeada1433e4b45ffb5f49c824639f /spec/frontend/issues_list | |
parent | d30a9499faf30d5f5424a52b2df286c724e253d1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/issues_list')
-rw-r--r-- | spec/frontend/issues_list/components/issues_list_app_spec.js | 19 | ||||
-rw-r--r-- | spec/frontend/issues_list/utils_spec.js | 8 |
2 files changed, 14 insertions, 13 deletions
diff --git a/spec/frontend/issues_list/components/issues_list_app_spec.js b/spec/frontend/issues_list/components/issues_list_app_spec.js index c0b3ad0f21f..9fbbeadb1d0 100644 --- a/spec/frontend/issues_list/components/issues_list_app_spec.js +++ b/spec/frontend/issues_list/components/issues_list_app_spec.js @@ -11,11 +11,12 @@ import IssuableList from '~/issuable_list/components/issuable_list_root.vue'; import { IssuableListTabs, IssuableStates } from '~/issuable_list/constants'; import IssuesListApp from '~/issues_list/components/issues_list_app.vue'; import { + apiSortParams, CREATED_DESC, PAGE_SIZE, PAGE_SIZE_MANUAL, - RELATIVE_POSITION_ASC, - sortParams, + RELATIVE_POSITION_DESC, + urlSortParams, } from '~/issues_list/constants'; import eventHub from '~/issues_list/eventhub'; import { getSortOptions } from '~/issues_list/utils'; @@ -146,7 +147,7 @@ describe('IssuesListApp component', () => { describe('csv import/export component', () => { describe('when user is signed in', () => { it('renders', async () => { - const search = '?page=1&search=refactor&state=opened&order_by=created_at&sort=desc'; + const search = '?page=1&search=refactor&state=opened&sort=created_date'; global.jsdom.reconfigure({ url: `${TEST_HOST}${search}` }); @@ -239,14 +240,14 @@ describe('IssuesListApp component', () => { }); describe('sort', () => { - it.each(Object.keys(sortParams))('is set as %s from the url params', (sortKey) => { - global.jsdom.reconfigure({ url: setUrlParams(sortParams[sortKey], TEST_HOST) }); + it.each(Object.keys(urlSortParams))('is set as %s from the url params', (sortKey) => { + global.jsdom.reconfigure({ url: setUrlParams(urlSortParams[sortKey], TEST_HOST) }); wrapper = mountComponent(); expect(findIssuableList().props()).toMatchObject({ initialSortBy: sortKey, - urlParams: sortParams[sortKey], + urlParams: urlSortParams[sortKey], }); }); }); @@ -528,7 +529,7 @@ describe('IssuesListApp component', () => { }); describe('when "sort" event is emitted by IssuableList', () => { - it.each(Object.keys(sortParams))( + it.each(Object.keys(apiSortParams))( 'fetches issues with correct params with payload `%s`', async (sortKey) => { wrapper = mountComponent(); @@ -539,10 +540,10 @@ describe('IssuesListApp component', () => { expect(axiosMock.history.get[1].params).toEqual({ page: xPage, - per_page: sortKey === RELATIVE_POSITION_ASC ? PAGE_SIZE_MANUAL : PAGE_SIZE, + per_page: sortKey === RELATIVE_POSITION_DESC ? PAGE_SIZE_MANUAL : PAGE_SIZE, state, with_labels_details: true, - ...sortParams[sortKey], + ...apiSortParams[sortKey], }); }, ); diff --git a/spec/frontend/issues_list/utils_spec.js b/spec/frontend/issues_list/utils_spec.js index 282080a1417..76a23832687 100644 --- a/spec/frontend/issues_list/utils_spec.js +++ b/spec/frontend/issues_list/utils_spec.js @@ -8,7 +8,7 @@ import { urlParams, urlParamsWithSpecialValues, } from 'jest/issues_list/mock_data'; -import { sortParams } from '~/issues_list/constants'; +import { urlSortParams } from '~/issues_list/constants'; import { convertToApiParams, convertToSearchQuery, @@ -19,9 +19,9 @@ import { } from '~/issues_list/utils'; describe('getSortKey', () => { - it.each(Object.keys(sortParams))('returns %s given the correct inputs', (sortKey) => { - const { order_by, sort } = sortParams[sortKey]; - expect(getSortKey(order_by, sort)).toBe(sortKey); + it.each(Object.keys(urlSortParams))('returns %s given the correct inputs', (sortKey) => { + const { sort } = urlSortParams[sortKey]; + expect(getSortKey(sort)).toBe(sortKey); }); }); |