Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8969affd
Commit
8969affd
authored
Dec 08, 2021
by
🕺 Winnie 🕺
Committed by
Natalia Tepluhina
Dec 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global Vue instance in Jest (vue_shared)
parent
c60c6ed3
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
110 additions
and
176 deletions
+110
-176
ee/spec/frontend/vue_shared/components/incidents/service_level_agreement_spec.js
...ared/components/incidents/service_level_agreement_spec.js
+3
-6
ee/spec/frontend/vue_shared/license_compliance/components/delete_confirmation_modal_spec.js
...e_compliance/components/delete_confirmation_modal_spec.js
+3
-4
ee/spec/frontend/vue_shared/license_compliance/mr_widget_license_report_spec.js
...hared/license_compliance/mr_widget_license_report_spec.js
+3
-4
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
...hared/metrics_reports/grouped_metrics_reports_app_spec.js
+3
-4
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/payment_method_spec.js
.../purchase_flow/components/checkout/payment_method_spec.js
+2
-4
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/zuora_spec.js
...ue_shared/purchase_flow/components/checkout/zuora_spec.js
+3
-4
ee/spec/frontend/vue_shared/purchase_flow/components/step_spec.js
...frontend/vue_shared/purchase_flow/components/step_spec.js
+3
-4
ee/spec/frontend/vue_shared/security_reports/components/create_jira_issue_spec.js
...red/security_reports/components/create_jira_issue_spec.js
+3
-5
spec/frontend/issuable/components/issuable_header_warnings_spec.js
...tend/issuable/components/issuable_header_warnings_spec.js
+2
-4
spec/frontend/vue_shared/components/diff_viewer/viewers/renamed_spec.js
...vue_shared/components/diff_viewer/viewers/renamed_spec.js
+3
-4
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
+3
-4
spec/frontend/vue_shared/components/notes/placeholder_note_spec.js
...tend/vue_shared/components/notes/placeholder_note_spec.js
+3
-4
spec/frontend/vue_shared/components/project_selector/project_list_item_spec.js
...red/components/project_selector/project_list_item_spec.js
+3
-5
spec/frontend/vue_shared/components/project_selector/project_selector_spec.js
...ared/components/project_selector/project_selector_spec.js
+1
-4
spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js
...nts/runner_instructions/runner_instructions_modal_spec.js
+4
-6
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_button_spec.js
...ponents/sidebar/labels_select_vue/dropdown_button_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
...r/labels_select_vue/dropdown_contents_create_view_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js
...r/labels_select_vue/dropdown_contents_labels_view_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_spec.js
...nents/sidebar/labels_select_vue/dropdown_contents_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_title_spec.js
...mponents/sidebar/labels_select_vue/dropdown_title_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_value_spec.js
...mponents/sidebar/labels_select_vue/dropdown_value_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/labels_select_root_spec.js
...ents/sidebar/labels_select_vue/labels_select_root_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_create_view_spec.js
...abels_select_widget/dropdown_contents_create_view_spec.js
+3
-5
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_labels_view_spec.js
...abels_select_widget/dropdown_contents_labels_view_spec.js
+3
-5
spec/frontend/vue_shared/components/user_select_spec.js
spec/frontend/vue_shared/components/user_select_spec.js
+3
-5
spec/frontend/vue_shared/components/vuex_module_provider_spec.js
...ontend/vue_shared/components/vuex_module_provider_spec.js
+3
-4
spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js
spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js
+5
-6
spec/frontend/vue_shared/translate_spec.js
spec/frontend/vue_shared/translate_spec.js
+30
-57
No files found.
ee/spec/frontend/vue_shared/components/incidents/service_level_agreement_spec.js
View file @
8969affd
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
getIncidentStateQuery
from
'
ee/graphql_shared/queries/get_incident_state.query.graphql
'
;
import
ServiceLevelAgreementCell
from
'
ee/vue_shared/components/incidents/service_level_agreement.vue
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
calculateRemainingMilliseconds
,
formatTime
}
from
'
~/lib/utils/datetime_utility
'
;
const
localVue
=
createLocalVue
();
const
formatTimeActual
=
jest
.
requireActual
(
'
~/lib/utils/datetime_utility
'
).
formatTime
;
jest
.
mock
(
'
~/lib/utils/datetime_utility
'
,
()
=>
({
...
...
@@ -39,7 +37,7 @@ describe('Service Level Agreement', () => {
};
function
createMockApolloProvider
(
issueState
)
{
local
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
requestHandlers
=
[
[
getIncidentStateQuery
,
jest
.
fn
().
mockResolvedValue
(
issueStateResponse
(
issueState
))],
...
...
@@ -50,7 +48,6 @@ describe('Service Level Agreement', () => {
function
mountComponent
({
mockApollo
,
props
}
=
{})
{
wrapper
=
shallowMount
(
ServiceLevelAgreementCell
,
{
localVue
,
apolloProvider
:
mockApollo
,
propsData
:
{
...
props
,
...
...
ee/spec/frontend/vue_shared/license_compliance/components/delete_confirmation_modal_spec.js
View file @
8969affd
import
{
GlModal
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Component
from
'
ee/vue_shared/license_compliance/components/delete_confirmation_modal.vue
'
;
import
{
approvedLicense
}
from
'
../mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
DeleteConfirmationModal
'
,
()
=>
{
let
store
;
...
...
@@ -36,7 +36,6 @@ describe('DeleteConfirmationModal', () => {
store
=
createStore
(
initialState
);
wrapper
=
shallowMount
(
Component
,
{
localVue
,
store
,
stubs
:
{
GlModal
,
...
...
ee/spec/frontend/vue_shared/license_compliance/mr_widget_license_report_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
LicenseManagement
from
'
ee/vue_shared/license_compliance/mr_widget_license_report.vue
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
...
...
@@ -13,8 +14,7 @@ import {
generateReportGroup
,
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
License Report MR Widget
'
,
()
=>
{
const
apiUrl
=
`
${
TEST_HOST
}
/license_management`
;
...
...
@@ -82,7 +82,6 @@ describe('License Report MR Widget', () => {
},
});
wrapper
=
shallowMount
(
LicenseManagement
,
{
localVue
,
propsData
:
props
,
store
,
stubs
,
...
...
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
View file @
8969affd
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
MetricsReportsIssueBody
from
'
ee/vue_shared/metrics_reports/components/metrics_reports_issue_body.vue
'
;
import
GroupedMetricsReportsApp
from
'
ee/vue_shared/metrics_reports/grouped_metrics_reports_app.vue
'
;
...
...
@@ -7,8 +8,7 @@ import Api from '~/api';
jest
.
mock
(
'
~/api.js
'
);
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
Grouped metrics reports app
'
,
()
=>
{
let
wrapper
;
...
...
@@ -19,7 +19,6 @@ describe('Grouped metrics reports app', () => {
const
mountComponent
=
(
glFeatures
=
{})
=>
{
wrapper
=
mount
(
GroupedMetricsReportsApp
,
{
store
:
mockStore
,
localVue
,
propsData
:
{
endpoint
:
'
metrics.json
'
,
},
...
...
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/payment_method_spec.js
View file @
8969affd
import
{
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
merge
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
{
mockParsedNamespaces
,
...
...
@@ -14,8 +14,7 @@ import { createMockApolloProvider } from 'ee_jest/vue_shared/purchase_flow/spec_
import
Zuora
from
'
ee/vue_shared/purchase_flow/components/checkout/zuora.vue
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
describe
(
'
Payment Method
'
,
()
=>
{
let
wrapper
;
...
...
@@ -36,7 +35,6 @@ describe('Payment Method', () => {
});
return
mountExtended
(
PaymentMethod
,
{
localVue
,
apolloProvider
,
});
};
...
...
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/zuora_spec.js
View file @
8969affd
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
{
merge
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
{
resolvers
}
from
'
ee/subscriptions/buy_addons_shared/graphql/resolvers
'
;
import
{
STEPS
}
from
'
ee/subscriptions/constants
'
;
...
...
@@ -12,8 +13,7 @@ import { createMockApolloProvider } from 'ee_jest/vue_shared/purchase_flow/spec_
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
flushPromises
from
'
helpers/flush_promises
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
describe
(
'
Zuora
'
,
()
=>
{
let
axiosMock
;
...
...
@@ -36,7 +36,6 @@ describe('Zuora', () => {
data
()
{
return
{
...
data
};
},
localVue
,
});
};
...
...
ee/spec/frontend/vue_shared/purchase_flow/components/step_spec.js
View file @
8969affd
import
{
GlButton
,
GlFormGroup
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
Step
from
'
ee/vue_shared/purchase_flow/components/step.vue
'
;
import
StepSummary
from
'
ee/vue_shared/purchase_flow/components/step_summary.vue
'
;
...
...
@@ -10,8 +11,7 @@ import flash from '~/flash';
import
{
STEPS
}
from
'
../mock_data
'
;
import
{
createMockApolloProvider
}
from
'
../spec_helper
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
jest
.
mock
(
'
~/flash
'
);
...
...
@@ -34,7 +34,6 @@ describe('Step', () => {
function
createComponent
(
options
=
{})
{
const
{
apolloProvider
,
propsData
}
=
options
;
return
shallowMount
(
Step
,
{
localVue
,
propsData
:
{
...
initialProps
,
...
propsData
},
apolloProvider
,
stubs
:
{
...
...
ee/spec/frontend/vue_shared/security_reports/components/create_jira_issue_spec.js
View file @
8969affd
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
createLocalVue
,
mount
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
Component
,
{
i18n
}
from
'
ee/vue_shared/security_reports/components/create_jira_issue.vue
'
;
import
vulnerabilityExternalIssueLinkCreate
from
'
ee/vue_shared/security_reports/graphql/vulnerabilityExternalIssueLinkCreate.mutation.graphql
'
;
...
...
@@ -7,8 +8,6 @@ import createMockApollo from 'helpers/mock_apollo_helper';
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
vulnerabilityExternalIssueLinkCreateMockFactory
}
from
'
./apollo_mocks
'
;
const
localVue
=
createLocalVue
();
describe
(
'
create_jira_issue
'
,
()
=>
{
let
wrapper
;
...
...
@@ -34,7 +33,7 @@ describe('create_jira_issue', () => {
const
pendingHandler
=
jest
.
fn
().
mockReturnValue
(
new
Promise
(()
=>
{}));
function
createMockApolloProvider
(
handler
)
{
local
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
requestHandlers
=
[[
vulnerabilityExternalIssueLinkCreate
,
handler
]];
return
createMockApollo
(
requestHandlers
);
...
...
@@ -42,7 +41,6 @@ describe('create_jira_issue', () => {
const
createComponent
=
(
options
=
{})
=>
{
wrapper
=
mount
(
Component
,
{
localVue
,
apolloProvider
:
options
.
mockApollo
,
propsData
:
{
...
defaultProps
,
...
...
spec/frontend/issuable/components/issuable_header_warnings_spec.js
View file @
8969affd
import
{
createLocalVue
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
...
...
@@ -9,8 +9,7 @@ import IssuableHeaderWarnings from '~/issuable/components/issuable_header_warnin
const
ISSUABLE_TYPE_ISSUE
=
'
issue
'
;
const
ISSUABLE_TYPE_MR
=
'
merge request
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
IssuableHeaderWarnings
'
,
()
=>
{
let
wrapper
;
...
...
@@ -24,7 +23,6 @@ describe('IssuableHeaderWarnings', () => {
const
createComponent
=
({
store
,
provide
})
=>
{
wrapper
=
shallowMountExtended
(
IssuableHeaderWarnings
,
{
store
,
localVue
,
provide
,
directives
:
{
GlTooltip
:
createMockDirective
(),
...
...
spec/frontend/vue_shared/components/diff_viewer/viewers/renamed_spec.js
View file @
8969affd
import
{
createLocalVue
,
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
TRANSITION_LOAD_START
,
...
...
@@ -11,15 +12,13 @@ import {
}
from
'
~/diffs/constants
'
;
import
Renamed
from
'
~/vue_shared/components/diff_viewer/viewers/renamed.vue
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
function
createRenamedComponent
({
props
=
{},
store
=
new
Vuex
.
Store
({}),
deep
=
false
})
{
const
mnt
=
deep
?
mount
:
shallowMount
;
return
mnt
(
Renamed
,
{
propsData
:
{
...
props
},
localVue
,
store
,
});
}
...
...
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
View file @
8969affd
import
{
GlModal
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
BV_SHOW_MODAL
,
BV_HIDE_MODAL
}
from
'
~/lib/utils/constants
'
;
import
GlModalVuex
from
'
~/vue_shared/components/gl_modal_vuex.vue
'
;
import
createState
from
'
~/vuex_shared/modules/modal/state
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
const
TEST_SLOT
=
'
Lorem ipsum modal dolar sit.
'
;
const
TEST_MODAL_ID
=
'
my-modal-id
'
;
...
...
@@ -36,7 +36,6 @@ describe('GlModalVuex', () => {
wrapper
=
shallowMount
(
GlModalVuex
,
{
...
options
,
localVue
,
store
,
propsData
,
stubs
:
{
...
...
spec/frontend/vue_shared/components/notes/placeholder_note_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
IssuePlaceholderNote
from
'
~/vue_shared/components/notes/placeholder_note.vue
'
;
import
{
userDataMock
}
from
'
../../../notes/mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
const
getters
=
{
getUserData
:
()
=>
userDataMock
,
...
...
@@ -17,7 +17,6 @@ describe('Issue placeholder note component', () => {
const
createComponent
=
(
isIndividual
=
false
)
=>
{
wrapper
=
shallowMount
(
IssuePlaceholderNote
,
{
localVue
,
store
:
new
Vuex
.
Store
({
getters
,
}),
...
...
spec/frontend/vue_shared/components/project_selector/project_list_item_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
mockProjects
from
'
test_fixtures_static/projects.json
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
ProjectAvatar
from
'
~/vue_shared/components/deprecated_project_avatar/default.vue
'
;
import
ProjectListItem
from
'
~/vue_shared/components/project_selector/project_list_item.vue
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ProjectListItem component
'
,
()
=>
{
const
Component
=
local
Vue
.
extend
(
ProjectListItem
);
const
Component
=
Vue
.
extend
(
ProjectListItem
);
let
wrapper
;
let
vm
;
let
options
;
...
...
@@ -20,7 +19,6 @@ describe('ProjectListItem component', () => {
project
,
selected
:
false
,
},
localVue
,
};
});
...
...
spec/frontend/vue_shared/components/project_selector/project_selector_spec.js
View file @
8969affd
import
{
GlSearchBoxByType
,
GlInfiniteScroll
}
from
'
@gitlab/ui
'
;
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
head
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
mockProjects
from
'
test_fixtures_static/projects.json
'
;
...
...
@@ -7,8 +7,6 @@ import { trimText } from 'helpers/text_helper';
import
ProjectListItem
from
'
~/vue_shared/components/project_selector/project_list_item.vue
'
;
import
ProjectSelector
from
'
~/vue_shared/components/project_selector/project_selector.vue
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ProjectSelector component
'
,
()
=>
{
let
wrapper
;
let
vm
;
...
...
@@ -28,7 +26,6 @@ describe('ProjectSelector component', () => {
beforeEach
(()
=>
{
wrapper
=
mount
(
Vue
.
extend
(
ProjectSelector
),
{
localVue
,
propsData
:
{
projectSearchResults
:
searchResults
,
selectedProjects
:
selected
,
...
...
spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js
View file @
8969affd
import
{
GlAlert
,
GlModal
,
GlButton
,
GlLoadingIcon
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlBreakpointInstance
as
bp
}
from
'
@gitlab/ui/dist/utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
...
...
@@ -16,8 +16,7 @@ import {
mockGraphqlInstructionsWindows
,
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
let
resizeCallback
;
const
MockResizeObserver
=
{
...
...
@@ -33,7 +32,7 @@ const MockResizeObserver = {
},
};
local
Vue
.
directive
(
'
gl-resize-observer
'
,
MockResizeObserver
);
Vue
.
directive
(
'
gl-resize-observer
'
,
MockResizeObserver
);
jest
.
mock
(
'
@gitlab/ui/dist/utils
'
);
...
...
@@ -67,7 +66,6 @@ describe('RunnerInstructionsModal component', () => {
registrationToken
:
'
MY_TOKEN
'
,
...
props
,
},
localVue
,
apolloProvider
:
fakeApollo
,
...
options
,
}),
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_button_spec.js
View file @
8969affd
import
{
GlIcon
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownButton
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue
'
;
...
...
@@ -9,8 +10,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
import
{
mockConfig
}
from
'
./mock_data
'
;
let
store
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
store
=
new
Vuex
.
Store
(
labelSelectModule
());
...
...
@@ -18,7 +18,6 @@ const createComponent = (initialState = mockConfig) => {
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
return
shallowMount
(
DropdownButton
,
{
localVue
,
store
,
});
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
View file @
8969affd
import
{
GlButton
,
GlFormInput
,
GlLink
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownContentsCreateView
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
'
;
...
...
@@ -8,8 +9,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
import
{
mockConfig
,
mockSuggestedColors
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
store
=
new
Vuex
.
Store
(
labelSelectModule
());
...
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
return
shallowMount
(
DropdownContentsCreateView
,
{
localVue
,
store
,
});
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js
View file @
8969affd
...
...
@@ -5,7 +5,8 @@ import {
GlSearchBoxByType
,
GlLink
,
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
UP_KEY_CODE
,
DOWN_KEY_CODE
,
ENTER_KEY_CODE
,
ESC_KEY_CODE
}
from
'
~/lib/utils/keycodes
'
;
import
DropdownContentsLabelsView
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
'
;
...
...
@@ -18,8 +19,7 @@ import defaultState from '~/vue_shared/components/sidebar/labels_select_vue/stor
import
{
mockConfig
,
mockLabels
,
mockRegularLabel
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
DropdownContentsLabelsView
'
,
()
=>
{
let
wrapper
;
...
...
@@ -43,7 +43,6 @@ describe('DropdownContentsLabelsView', () => {
store
.
dispatch
(
'
receiveLabelsSuccess
'
,
mockLabels
);
wrapper
=
shallowMount
(
DropdownContentsLabelsView
,
{
localVue
,
store
,
});
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
DropdownVariant
}
from
'
~/vue_shared/components/sidebar/labels_select_vue/constants
'
;
...
...
@@ -7,8 +8,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
import
{
mockConfig
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
,
propsData
=
{})
=>
{
const
store
=
new
Vuex
.
Store
(
labelsSelectModule
());
...
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig, propsData = {}) => {
return
shallowMount
(
DropdownContents
,
{
propsData
,
localVue
,
store
,
});
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_title_spec.js
View file @
8969affd
import
{
GlButton
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownTitle
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_title.vue
'
;
...
...
@@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
import
{
mockConfig
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
store
=
new
Vuex
.
Store
(
labelsSelectModule
());
...
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
return
shallowMount
(
DropdownTitle
,
{
localVue
,
store
,
propsData
:
{
labelsSelectInProgress
:
false
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_value_spec.js
View file @
8969affd
import
{
GlLabel
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownValue
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue
'
;
...
...
@@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
import
{
mockConfig
,
mockLabels
,
mockRegularLabel
,
mockScopedLabel
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
DropdownValue
'
,
()
=>
{
let
wrapper
;
...
...
@@ -23,7 +23,6 @@ describe('DropdownValue', () => {
store
.
dispatch
(
'
setInitialState
'
,
{
...
mockConfig
,
...
initialState
});
wrapper
=
shallowMount
(
DropdownValue
,
{
localVue
,
store
,
slots
,
});
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/labels_select_root_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
isInViewport
}
from
'
~/lib/utils/common_utils
'
;
...
...
@@ -18,8 +19,7 @@ jest.mock('~/lib/utils/common_utils', () => ({
isInViewport
:
jest
.
fn
().
mockReturnValue
(
true
),
}));
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
describe
(
'
LabelsSelectRoot
'
,
()
=>
{
let
wrapper
;
...
...
@@ -27,7 +27,6 @@ describe('LabelsSelectRoot', () => {
const
createComponent
=
(
config
=
mockConfig
,
slots
=
{})
=>
{
wrapper
=
shallowMount
(
LabelsSelectRoot
,
{
localVue
,
slots
,
store
,
propsData
:
config
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_create_view_spec.js
View file @
8969affd
import
{
GlLoadingIcon
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
...
...
@@ -18,8 +18,7 @@ jest.mock('~/flash');
const
colors
=
Object
.
keys
(
mockSuggestedColors
);
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
userRecoverableError
=
{
...
createLabelSuccessfulResponse
,
...
...
@@ -63,7 +62,6 @@ describe('DropdownContentsCreateView', () => {
});
wrapper
=
shallowMount
(
DropdownContentsCreateView
,
{
localVue
,
apolloProvider
:
mockApollo
,
propsData
:
{
fullPath
:
''
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_labels_view_spec.js
View file @
8969affd
...
...
@@ -4,8 +4,8 @@ import {
GlDropdownItem
,
GlIntersectionObserver
,
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
...
...
@@ -19,8 +19,7 @@ import { mockConfig, workspaceLabelsQueryResponse } from './mock_data';
jest
.
mock
(
'
~/flash
'
);
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
localSelectedLabels
=
[
{
...
...
@@ -47,7 +46,6 @@ describe('DropdownContentsLabelsView', () => {
const
mockApollo
=
createMockApollo
([[
projectLabelsQuery
,
queryHandler
]]);
wrapper
=
shallowMount
(
DropdownContentsLabelsView
,
{
localVue
,
apolloProvider
:
mockApollo
,
provide
:
{
variant
:
DropdownVariant
.
Sidebar
,
...
...
spec/frontend/vue_shared/components/user_select_spec.js
View file @
8969affd
import
{
GlSearchBoxByType
,
GlDropdown
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
cloneDeep
}
from
'
lodash
'
;
import
{
nextTick
}
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
'
;
...
...
@@ -33,8 +33,7 @@ const waitForSearch = async () => {
await
waitForPromises
();
};
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
describe
(
'
User select dropdown
'
,
()
=>
{
let
wrapper
;
...
...
@@ -62,7 +61,6 @@ describe('User select dropdown', () => {
[
getIssueParticipantsQuery
,
participantsQueryHandler
],
]);
wrapper
=
shallowMount
(
UserSelect
,
{
localVue
,
apolloProvider
:
fakeApollo
,
propsData
:
{
headerText
:
'
test
'
,
...
...
spec/frontend/vue_shared/components/vuex_module_provider_spec.js
View file @
8969affd
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VuexModuleProvider
from
'
~/vue_shared/components/vuex_module_provider.vue
'
;
...
...
@@ -38,10 +38,9 @@ describe('~/vue_shared/components/vuex_module_provider', () => {
it
(
'
does not blow up when used with vue-apollo
'
,
()
=>
{
// See https://github.com/vuejs/vue-apollo/pull/1153 for details
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
createComponent
(
{
localVue
}
);
createComponent
();
expect
(
findProvidedVuexModule
()).
toBe
(
TEST_VUEX_MODULE
);
});
});
spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js
View file @
8969affd
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
GlFeatureFlags
from
'
~/vue_shared/gl_feature_flags_plugin
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
const
localVue
=
createLocalVue
();
describe
(
'
GitLab Feature Flags Plugin
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
...
...
@@ -17,7 +16,7 @@ describe('GitLab Feature Flags Plugin', () => {
},
};
local
Vue
.
use
(
GlFeatureFlags
);
Vue
.
use
(
GlFeatureFlags
);
});
it
(
'
should provide glFeatures to components
'
,
()
=>
{
...
...
@@ -25,7 +24,7 @@ describe('GitLab Feature Flags Plugin', () => {
template
:
`<span></span>`
,
inject
:
[
'
glFeatures
'
],
};
const
wrapper
=
shallowMount
(
component
,
{
localVue
}
);
const
wrapper
=
shallowMount
(
component
);
expect
(
wrapper
.
vm
.
glFeatures
).
toEqual
({
aFeature
:
true
,
bFeature
:
false
,
...
...
@@ -39,7 +38,7 @@ describe('GitLab Feature Flags Plugin', () => {
template
:
`<span></span>`
,
mixins
:
[
glFeatureFlagsMixin
()],
};
const
wrapper
=
shallowMount
(
component
,
{
localVue
}
);
const
wrapper
=
shallowMount
(
component
);
expect
(
wrapper
.
vm
.
glFeatures
).
toEqual
({
aFeature
:
true
,
bFeature
:
false
,
...
...
spec/frontend/vue_shared/translate_spec.js
View file @
8969affd
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
locale
from
'
~/locale
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
describe
(
'
Vue translate filter
'
,
()
=>
{
const
createTranslationMock
=
(
key
,
...
translations
)
=>
{
...
...
@@ -26,16 +26,13 @@ describe('Vue translate filter', () => {
const
translation
=
'
singular_translated
'
;
createTranslationMock
(
key
,
translation
);
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ __('
${
key
}
') }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
...
...
@@ -45,16 +42,13 @@ describe('Vue translate filter', () => {
const
translationPlural
=
'
plural_multiple translation
'
;
createTranslationMock
(
key
,
'
plural_singular translation
'
,
translationPlural
);
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ n__('
${
key
}
', 'plurals', 2) }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
translationPlural
);
});
...
...
@@ -67,31 +61,25 @@ describe('Vue translate filter', () => {
});
it
(
'
and n === 1
'
,
()
=>
{
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ n__('
${
key
}
', '%d days', 1) }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
'
1 singular translated
'
);
});
it
(
'
and n > 1
'
,
()
=>
{
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ n__('
${
key
}
', '%d days', 2) }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
'
2 plural translated
'
);
});
...
...
@@ -107,31 +95,25 @@ describe('Vue translate filter', () => {
});
it
(
'
and using two parameters
'
,
()
=>
{
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ s__('Context', 'Foobar') }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
expectation
);
});
it
(
'
and using the pipe syntax
'
,
()
=>
{
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ s__('
${
key
}
') }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
expectation
);
});
...
...
@@ -141,9 +123,8 @@ describe('Vue translate filter', () => {
const
translation
=
'
multiline string translated
'
;
createTranslationMock
(
'
multiline string
'
,
translation
);
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ __(\`
multiline
...
...
@@ -151,9 +132,7 @@ describe('Vue translate filter', () => {
\`) }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
...
...
@@ -163,9 +142,8 @@ describe('Vue translate filter', () => {
createTranslationMock
(
'
multiline string
'
,
'
multiline string singular
'
,
translation
);
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ n__(
\`
...
...
@@ -180,9 +158,7 @@ describe('Vue translate filter', () => {
) }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
...
...
@@ -192,9 +168,8 @@ describe('Vue translate filter', () => {
createTranslationMock
(
'
Context| multiline string
'
,
translation
);
const
wrapper
=
mount
(
{
template
:
`
const
wrapper
=
mount
({
template
:
`
<span>
{{ s__(
\`
...
...
@@ -205,9 +180,7 @@ describe('Vue translate filter', () => {
) }}
</span>
`
,
},
{
localVue
},
);
});
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment