From fc53ce8e6ca67bf217470179a1ea6cf139bcffad Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 12 Dec 2019 09:07:48 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../frontend/environments/environment_item_spec.js | 4 ++-- spec/frontend/jobs/components/erased_block_spec.js | 6 +++--- .../list/components/table_registry_spec.js | 2 +- .../list/components/release_block_footer_spec.js | 8 ++++---- .../releases/list/components/release_block_spec.js | 2 +- .../components/issue/related_issuable_item_spec.js | 4 ++-- spec/javascripts/diffs/components/app_spec.js | 1 + spec/javascripts/diffs/store/actions_spec.js | 4 ++++ spec/javascripts/diffs/store/mutations_spec.js | 4 +++- spec/javascripts/lib/utils/common_utils_spec.js | 22 ++++++++++++++++++++++ 10 files changed, 43 insertions(+), 14 deletions(-) (limited to 'spec') diff --git a/spec/frontend/environments/environment_item_spec.js b/spec/frontend/environments/environment_item_spec.js index 6184df0fdc2..52625c64a1c 100644 --- a/spec/frontend/environments/environment_item_spec.js +++ b/spec/frontend/environments/environment_item_spec.js @@ -45,9 +45,9 @@ describe('Environment item', () => { }); it('should render last deployment date', () => { - const formatedDate = format(environment.last_deployment.deployed_at); + const formattedDate = format(environment.last_deployment.deployed_at); - expect(wrapper.find('.environment-created-date-timeago').text()).toContain(formatedDate); + expect(wrapper.find('.environment-created-date-timeago').text()).toContain(formattedDate); }); describe('With user information', () => { diff --git a/spec/frontend/jobs/components/erased_block_spec.js b/spec/frontend/jobs/components/erased_block_spec.js index 5e6570f72e0..c7a53197fad 100644 --- a/spec/frontend/jobs/components/erased_block_spec.js +++ b/spec/frontend/jobs/components/erased_block_spec.js @@ -8,7 +8,7 @@ describe('Erased block', () => { const erasedAt = '2016-11-07T11:11:16.525Z'; const timeago = getTimeago(); - const formatedDate = timeago.format(erasedAt); + const formattedDate = timeago.format(erasedAt); const createComponent = props => { wrapper = mount(ErasedBlock, { @@ -41,7 +41,7 @@ describe('Erased block', () => { }); it('renders erasedAt', () => { - expect(wrapper.text().trim()).toContain(formatedDate); + expect(wrapper.text().trim()).toContain(formattedDate); }); }); @@ -57,7 +57,7 @@ describe('Erased block', () => { }); it('renders erasedAt', () => { - expect(wrapper.text().trim()).toContain(formatedDate); + expect(wrapper.text().trim()).toContain(formattedDate); }); }); }); diff --git a/spec/frontend/registry/list/components/table_registry_spec.js b/spec/frontend/registry/list/components/table_registry_spec.js index 1d31381c85b..fe099adbdfb 100644 --- a/spec/frontend/registry/list/components/table_registry_spec.js +++ b/spec/frontend/registry/list/components/table_registry_spec.js @@ -68,7 +68,7 @@ describe('table registry', () => { expect(tds.at(2).html()).toContain(repoPropsData.list[0].shortRevision); expect(tds.at(3).html()).toContain(repoPropsData.list[0].layers); expect(tds.at(3).html()).toContain(repoPropsData.list[0].size); - expect(tds.at(4).html()).toContain(wrapper.vm.timeFormated(repoPropsData.list[0].createdAt)); + expect(tds.at(4).html()).toContain(wrapper.vm.timeFormatted(repoPropsData.list[0].createdAt)); }); it('should have a label called Image ID', () => { diff --git a/spec/frontend/releases/list/components/release_block_footer_spec.js b/spec/frontend/releases/list/components/release_block_footer_spec.js index 36a94b21df1..7652acbdd62 100644 --- a/spec/frontend/releases/list/components/release_block_footer_spec.js +++ b/spec/frontend/releases/list/components/release_block_footer_spec.js @@ -8,8 +8,8 @@ import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; jest.mock('~/vue_shared/mixins/timeago', () => ({ methods: { - timeFormated() { - return '7 fortnightes ago'; + timeFormatted() { + return '7 fortnights ago'; }, tooltipTitle() { return 'February 30, 2401'; @@ -82,7 +82,7 @@ describe('Release block footer', () => { it('renders the author and creation time info', () => { expect(trimText(authorDateInfoSection().text())).toBe( - `Created 7 fortnightes ago by ${releaseClone.author.username}`, + `Created 7 fortnights ago by ${releaseClone.author.username}`, ); }); @@ -139,7 +139,7 @@ describe('Release block footer', () => { beforeEach(() => factory({ author: undefined })); it('renders the release date without the author name', () => { - expect(trimText(authorDateInfoSection().text())).toBe('Created 7 fortnightes ago'); + expect(trimText(authorDateInfoSection().text())).toBe('Created 7 fortnights ago'); }); }); diff --git a/spec/frontend/releases/list/components/release_block_spec.js b/spec/frontend/releases/list/components/release_block_spec.js index c83af01f6e0..38c5e4fc0a2 100644 --- a/spec/frontend/releases/list/components/release_block_spec.js +++ b/spec/frontend/releases/list/components/release_block_spec.js @@ -68,7 +68,7 @@ describe('Release block', () => { }); it('renders release date', () => { - expect(wrapper.text()).toContain(timeagoMixin.methods.timeFormated(release.released_at)); + expect(wrapper.text()).toContain(timeagoMixin.methods.timeFormatted(release.released_at)); }); it('renders number of assets provided', () => { diff --git a/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js b/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js index 1500bdf9c70..3cc640cb00d 100644 --- a/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js +++ b/spec/frontend/vue_shared/components/issue/related_issuable_item_spec.js @@ -90,11 +90,11 @@ describe('RelatedIssuableItem', () => { it('renders state title', () => { const stateTitle = tokenState.attributes('title'); - const formatedCreateDate = formatDate(props.createdAt); + const formattedCreateDate = formatDate(props.createdAt); expect(stateTitle).toContain('Opened'); - expect(stateTitle).toContain(`${formatedCreateDate}`); + expect(stateTitle).toContain(`${formattedCreateDate}`); }); it('renders aria label', () => { diff --git a/spec/javascripts/diffs/components/app_spec.js b/spec/javascripts/diffs/components/app_spec.js index dbeff7284ce..b21cab58b4e 100644 --- a/spec/javascripts/diffs/components/app_spec.js +++ b/spec/javascripts/diffs/components/app_spec.js @@ -41,6 +41,7 @@ describe('diffs/components/app', () => { changesEmptyStateIllustration: '', dismissEndpoint: '', showSuggestPopover: true, + useSingleDiffStyle: false, ...props, }, store, diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js index 95fd43367e5..163d530a2b6 100644 --- a/spec/javascripts/diffs/store/actions_spec.js +++ b/spec/javascripts/diffs/store/actions_spec.js @@ -75,6 +75,7 @@ describe('DiffsStoreActions', () => { const projectPath = '/root/project'; const dismissEndpoint = '/-/user_callouts'; const showSuggestPopover = false; + const useSingleDiffStyle = false; testAction( setBaseConfig, @@ -85,6 +86,7 @@ describe('DiffsStoreActions', () => { projectPath, dismissEndpoint, showSuggestPopover, + useSingleDiffStyle, }, { endpoint: '', @@ -93,6 +95,7 @@ describe('DiffsStoreActions', () => { projectPath: '', dismissEndpoint: '', showSuggestPopover: true, + useSingleDiffStyle: true, }, [ { @@ -104,6 +107,7 @@ describe('DiffsStoreActions', () => { projectPath, dismissEndpoint, showSuggestPopover, + useSingleDiffStyle, }, }, ], diff --git a/spec/javascripts/diffs/store/mutations_spec.js b/spec/javascripts/diffs/store/mutations_spec.js index 19bf5bdd592..13f16e4f9a6 100644 --- a/spec/javascripts/diffs/store/mutations_spec.js +++ b/spec/javascripts/diffs/store/mutations_spec.js @@ -10,11 +10,13 @@ describe('DiffsStoreMutations', () => { const state = {}; const endpoint = '/diffs/endpoint'; const projectPath = '/root/project'; + const useSingleDiffStyle = false; - mutations[types.SET_BASE_CONFIG](state, { endpoint, projectPath }); + mutations[types.SET_BASE_CONFIG](state, { endpoint, projectPath, useSingleDiffStyle }); expect(state.endpoint).toEqual(endpoint); expect(state.projectPath).toEqual(projectPath); + expect(state.useSingleDiffStyle).toEqual(useSingleDiffStyle); }); }); diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js index 484133c9ac4..e471be608c8 100644 --- a/spec/javascripts/lib/utils/common_utils_spec.js +++ b/spec/javascripts/lib/utils/common_utils_spec.js @@ -721,6 +721,28 @@ describe('common_utils', () => { }); }); + describe('convertObjectPropsToSnakeCase', () => { + it('converts each object key to snake case', () => { + const obj = { + some: 'some', + 'cool object': 'cool object', + likeThisLongOne: 'likeThisLongOne', + }; + + expect(commonUtils.convertObjectPropsToSnakeCase(obj)).toEqual({ + some: 'some', + cool_object: 'cool object', + like_this_long_one: 'likeThisLongOne', + }); + }); + + it('returns an empty object if there are no keys', () => { + ['', {}, [], null].forEach(badObj => { + expect(commonUtils.convertObjectPropsToSnakeCase(badObj)).toEqual({}); + }); + }); + }); + describe('with options', () => { const objWithoutChildren = { project_name: 'GitLab CE', -- cgit v1.2.3