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
7c1fa749
Commit
7c1fa749
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 37 files - 63 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
5c23cb94
Changes
38
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
92 additions
and
131 deletions
+92
-131
.prettierignore
.prettierignore
+0
-39
spec/frontend/logs/components/environment_logs_spec.js
spec/frontend/logs/components/environment_logs_spec.js
+3
-3
spec/frontend/logs/components/log_advanced_filters_spec.js
spec/frontend/logs/components/log_advanced_filters_spec.js
+2
-2
spec/frontend/logs/components/log_control_buttons_spec.js
spec/frontend/logs/components/log_control_buttons_spec.js
+1
-1
spec/frontend/logs/components/log_simple_filters_spec.js
spec/frontend/logs/components/log_simple_filters_spec.js
+1
-1
spec/frontend/logs/stores/actions_spec.js
spec/frontend/logs/stores/actions_spec.js
+1
-1
spec/frontend/logs/stores/mutations_spec.js
spec/frontend/logs/stores/mutations_spec.js
+1
-1
spec/frontend/matchers.js
spec/frontend/matchers.js
+2
-2
spec/frontend/matchers_spec.js
spec/frontend/matchers_spec.js
+2
-2
spec/frontend/members/components/avatars/user_avatar_spec.js
spec/frontend/members/components/avatars/user_avatar_spec.js
+1
-1
spec/frontend/members/components/filter_sort/filter_sort_container_spec.js
...bers/components/filter_sort/filter_sort_container_spec.js
+1
-1
spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js
...omponents/filter_sort/members_filtered_search_bar_spec.js
+1
-1
spec/frontend/members/components/filter_sort/sort_dropdown_spec.js
...tend/members/components/filter_sort/sort_dropdown_spec.js
+4
-4
spec/frontend/members/components/modals/remove_group_link_modal_spec.js
...members/components/modals/remove_group_link_modal_spec.js
+1
-1
spec/frontend/members/components/table/created_at_spec.js
spec/frontend/members/components/table/created_at_spec.js
+1
-1
spec/frontend/members/components/table/expiration_datepicker_spec.js
...nd/members/components/table/expiration_datepicker_spec.js
+1
-1
spec/frontend/members/components/table/expires_at_spec.js
spec/frontend/members/components/table/expires_at_spec.js
+2
-2
spec/frontend/members/components/table/member_avatar_spec.js
spec/frontend/members/components/table/member_avatar_spec.js
+1
-1
spec/frontend/members/components/table/member_source_spec.js
spec/frontend/members/components/table/member_source_spec.js
+2
-2
spec/frontend/members/components/table/members_table_spec.js
spec/frontend/members/components/table/members_table_spec.js
+1
-1
spec/frontend/members/components/table/role_dropdown_spec.js
spec/frontend/members/components/table/role_dropdown_spec.js
+4
-4
spec/frontend/members/utils_spec.js
spec/frontend/members/utils_spec.js
+1
-1
spec/frontend/merge_request_spec.js
spec/frontend/merge_request_spec.js
+4
-4
spec/frontend/merge_request_tabs_spec.js
spec/frontend/merge_request_tabs_spec.js
+2
-2
spec/frontend/milestones/milestone_combobox_spec.js
spec/frontend/milestones/milestone_combobox_spec.js
+5
-5
spec/frontend/mini_pipeline_graph_dropdown_spec.js
spec/frontend/mini_pipeline_graph_dropdown_spec.js
+2
-2
spec/frontend/mocks/ce/lib/utils/axios_utils.js
spec/frontend/mocks/ce/lib/utils/axios_utils.js
+7
-7
spec/frontend/mocks/mocks_helper.js
spec/frontend/mocks/mocks_helper.js
+3
-3
spec/frontend/mocks/mocks_helper_spec.js
spec/frontend/mocks/mocks_helper_spec.js
+5
-5
spec/frontend/monitoring/alert_widget_spec.js
spec/frontend/monitoring/alert_widget_spec.js
+3
-3
spec/frontend/monitoring/components/charts/annotations_spec.js
...frontend/monitoring/components/charts/annotations_spec.js
+3
-3
spec/frontend/monitoring/components/charts/anomaly_spec.js
spec/frontend/monitoring/components/charts/anomaly_spec.js
+2
-2
spec/frontend/monitoring/components/charts/bar_spec.js
spec/frontend/monitoring/components/charts/bar_spec.js
+1
-1
spec/frontend/monitoring/components/charts/column_spec.js
spec/frontend/monitoring/components/charts/column_spec.js
+2
-2
spec/frontend/monitoring/components/charts/gauge_spec.js
spec/frontend/monitoring/components/charts/gauge_spec.js
+2
-2
spec/frontend/monitoring/components/charts/options_spec.js
spec/frontend/monitoring/components/charts/options_spec.js
+6
-6
spec/frontend/monitoring/components/charts/stacked_column_spec.js
...ntend/monitoring/components/charts/stacked_column_spec.js
+2
-2
spec/frontend/monitoring/components/charts/time_series_spec.js
...frontend/monitoring/components/charts/time_series_spec.js
+9
-9
No files found.
.prettierignore
View file @
7c1fa749
...
@@ -1887,45 +1887,6 @@ spec/frontend/helpers/vuex_action_helper_spec.js
...
@@ -1887,45 +1887,6 @@ spec/frontend/helpers/vuex_action_helper_spec.js
spec/frontend/helpers/wait_for_promises.js
spec/frontend/helpers/wait_for_promises.js
spec/frontend/helpers/wait_using_real_timer.js
spec/frontend/helpers/wait_using_real_timer.js
## determined-shamir
spec/frontend/logs/components/environment_logs_spec.js
spec/frontend/logs/components/log_advanced_filters_spec.js
spec/frontend/logs/components/log_control_buttons_spec.js
spec/frontend/logs/components/log_simple_filters_spec.js
spec/frontend/logs/stores/actions_spec.js
spec/frontend/logs/stores/mutations_spec.js
spec/frontend/matchers.js
spec/frontend/matchers_spec.js
spec/frontend/members/components/avatars/user_avatar_spec.js
spec/frontend/members/components/filter_sort/filter_sort_container_spec.js
spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js
spec/frontend/members/components/filter_sort/sort_dropdown_spec.js
spec/frontend/members/components/modals/remove_group_link_modal_spec.js
spec/frontend/members/components/table/created_at_spec.js
spec/frontend/members/components/table/expiration_datepicker_spec.js
spec/frontend/members/components/table/expires_at_spec.js
spec/frontend/members/components/table/member_avatar_spec.js
spec/frontend/members/components/table/member_source_spec.js
spec/frontend/members/components/table/members_table_spec.js
spec/frontend/members/components/table/role_dropdown_spec.js
spec/frontend/members/utils_spec.js
spec/frontend/merge_request_spec.js
spec/frontend/merge_request_tabs_spec.js
spec/frontend/milestones/milestone_combobox_spec.js
spec/frontend/mini_pipeline_graph_dropdown_spec.js
spec/frontend/mocks/ce/lib/utils/axios_utils.js
spec/frontend/mocks/mocks_helper.js
spec/frontend/mocks/mocks_helper_spec.js
spec/frontend/monitoring/alert_widget_spec.js
spec/frontend/monitoring/components/charts/annotations_spec.js
spec/frontend/monitoring/components/charts/anomaly_spec.js
spec/frontend/monitoring/components/charts/bar_spec.js
spec/frontend/monitoring/components/charts/column_spec.js
spec/frontend/monitoring/components/charts/gauge_spec.js
spec/frontend/monitoring/components/charts/options_spec.js
spec/frontend/monitoring/components/charts/stacked_column_spec.js
spec/frontend/monitoring/components/charts/time_series_spec.js
## beautiful-benz
## beautiful-benz
spec/frontend/monitoring/components/dashboard_actions_menu_spec.js
spec/frontend/monitoring/components/dashboard_actions_menu_spec.js
spec/frontend/monitoring/components/dashboard_header_spec.js
spec/frontend/monitoring/components/dashboard_header_spec.js
...
...
spec/frontend/logs/components/environment_logs_spec.js
View file @
7c1fa749
...
@@ -20,7 +20,7 @@ jest.mock('~/lib/utils/scroll_utils');
...
@@ -20,7 +20,7 @@ jest.mock('~/lib/utils/scroll_utils');
const
module
=
'
environmentLogs
'
;
const
module
=
'
environmentLogs
'
;
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
fn
(
func
=>
{
jest
.
fn
(
(
func
)
=>
{
return
func
;
return
func
;
}),
}),
);
);
...
@@ -59,7 +59,7 @@ describe('EnvironmentLogs', () => {
...
@@ -59,7 +59,7 @@ describe('EnvironmentLogs', () => {
const
findInfiniteScroll
=
()
=>
wrapper
.
find
({
ref
:
'
infiniteScroll
'
});
const
findInfiniteScroll
=
()
=>
wrapper
.
find
({
ref
:
'
infiniteScroll
'
});
const
findLogTrace
=
()
=>
wrapper
.
find
({
ref
:
'
logTrace
'
});
const
findLogTrace
=
()
=>
wrapper
.
find
({
ref
:
'
logTrace
'
});
const
findLogFooter
=
()
=>
wrapper
.
find
({
ref
:
'
logFooter
'
});
const
findLogFooter
=
()
=>
wrapper
.
find
({
ref
:
'
logFooter
'
});
const
getInfiniteScrollAttr
=
attr
=>
parseInt
(
findInfiniteScroll
().
attributes
(
attr
),
10
);
const
getInfiniteScrollAttr
=
(
attr
)
=>
parseInt
(
findInfiniteScroll
().
attributes
(
attr
),
10
);
const
mockSetInitData
=
()
=>
{
const
mockSetInitData
=
()
=>
{
state
.
pods
.
options
=
mockPods
;
state
.
pods
.
options
=
mockPods
;
...
@@ -213,7 +213,7 @@ describe('EnvironmentLogs', () => {
...
@@ -213,7 +213,7 @@ describe('EnvironmentLogs', () => {
describe
(
'
state with data
'
,
()
=>
{
describe
(
'
state with data
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
dispatch
.
mockImplementation
(
actionName
=>
{
dispatch
.
mockImplementation
(
(
actionName
)
=>
{
if
(
actionName
===
`
${
module
}
/setInitData`
)
{
if
(
actionName
===
`
${
module
}
/setInitData`
)
{
mockSetInitData
();
mockSetInitData
();
}
else
if
(
actionName
===
`
${
module
}
/showPodLogs`
)
{
}
else
if
(
actionName
===
`
${
module
}
/showPodLogs`
)
{
...
...
spec/frontend/logs/components/log_advanced_filters_spec.js
View file @
7c1fa749
...
@@ -18,10 +18,10 @@ describe('LogAdvancedFilters', () => {
...
@@ -18,10 +18,10 @@ describe('LogAdvancedFilters', () => {
const
findFilteredSearch
=
()
=>
wrapper
.
find
(
GlFilteredSearch
);
const
findFilteredSearch
=
()
=>
wrapper
.
find
(
GlFilteredSearch
);
const
findTimeRangePicker
=
()
=>
wrapper
.
find
({
ref
:
'
dateTimePicker
'
});
const
findTimeRangePicker
=
()
=>
wrapper
.
find
({
ref
:
'
dateTimePicker
'
});
const
getSearchToken
=
type
=>
const
getSearchToken
=
(
type
)
=>
findFilteredSearch
()
findFilteredSearch
()
.
props
(
'
availableTokens
'
)
.
props
(
'
availableTokens
'
)
.
filter
(
token
=>
token
.
type
===
type
)[
0
];
.
filter
(
(
token
)
=>
token
.
type
===
type
)[
0
];
const
mockStateLoading
=
()
=>
{
const
mockStateLoading
=
()
=>
{
state
.
timeRange
.
selected
=
defaultTimeRange
;
state
.
timeRange
.
selected
=
defaultTimeRange
;
...
...
spec/frontend/logs/components/log_control_buttons_spec.js
View file @
7c1fa749
...
@@ -9,7 +9,7 @@ describe('LogControlButtons', () => {
...
@@ -9,7 +9,7 @@ describe('LogControlButtons', () => {
const
findScrollToBottom
=
()
=>
wrapper
.
find
(
'
.js-scroll-to-bottom
'
);
const
findScrollToBottom
=
()
=>
wrapper
.
find
(
'
.js-scroll-to-bottom
'
);
const
findRefreshBtn
=
()
=>
wrapper
.
find
(
'
.js-refresh-log
'
);
const
findRefreshBtn
=
()
=>
wrapper
.
find
(
'
.js-refresh-log
'
);
const
initWrapper
=
opts
=>
{
const
initWrapper
=
(
opts
)
=>
{
wrapper
=
shallowMount
(
LogControlButtons
,
{
wrapper
=
shallowMount
(
LogControlButtons
,
{
listeners
:
{
listeners
:
{
scrollUp
:
()
=>
{},
scrollUp
:
()
=>
{},
...
...
spec/frontend/logs/components/log_simple_filters_spec.js
View file @
7c1fa749
...
@@ -18,7 +18,7 @@ describe('LogSimpleFilters', () => {
...
@@ -18,7 +18,7 @@ describe('LogSimpleFilters', () => {
const
findPodsDropdownItems
=
()
=>
const
findPodsDropdownItems
=
()
=>
findPodsDropdown
()
findPodsDropdown
()
.
findAll
(
GlDropdownItem
)
.
findAll
(
GlDropdownItem
)
.
filter
(
item
=>
!
(
'
disabled
'
in
item
.
attributes
()));
.
filter
(
(
item
)
=>
!
(
'
disabled
'
in
item
.
attributes
()));
const
mockPodsLoading
=
()
=>
{
const
mockPodsLoading
=
()
=>
{
state
.
pods
.
options
=
[];
state
.
pods
.
options
=
[];
...
...
spec/frontend/logs/stores/actions_spec.js
View file @
7c1fa749
...
@@ -62,7 +62,7 @@ describe('Logs Store actions', () => {
...
@@ -62,7 +62,7 @@ describe('Logs Store actions', () => {
const
latestGetParams
=
()
=>
mock
.
history
.
get
[
mock
.
history
.
get
.
length
-
1
].
params
;
const
latestGetParams
=
()
=>
mock
.
history
.
get
[
mock
.
history
.
get
.
length
-
1
].
params
;
convertToFixedRange
.
mockImplementation
(
range
=>
{
convertToFixedRange
.
mockImplementation
(
(
range
)
=>
{
if
(
range
===
defaultTimeRange
)
{
if
(
range
===
defaultTimeRange
)
{
return
{
...
mockDefaultRange
};
return
{
...
mockDefaultRange
};
}
}
...
...
spec/frontend/logs/stores/mutations_spec.js
View file @
7c1fa749
...
@@ -23,7 +23,7 @@ describe('Logs Store Mutations', () => {
...
@@ -23,7 +23,7 @@ describe('Logs Store Mutations', () => {
});
});
it
(
'
ensures mutation types are correctly named
'
,
()
=>
{
it
(
'
ensures mutation types are correctly named
'
,
()
=>
{
Object
.
keys
(
types
).
forEach
(
k
=>
{
Object
.
keys
(
types
).
forEach
(
(
k
)
=>
{
expect
(
k
).
toEqual
(
types
[
k
]);
expect
(
k
).
toEqual
(
types
[
k
]);
});
});
});
});
...
...
spec/frontend/matchers.js
View file @
7c1fa749
...
@@ -10,7 +10,7 @@ export default {
...
@@ -10,7 +10,7 @@ export default {
const
iconReferences
=
[].
slice
.
apply
(
element
.
querySelectorAll
(
'
svg use
'
));
const
iconReferences
=
[].
slice
.
apply
(
element
.
querySelectorAll
(
'
svg use
'
));
const
matchingIcon
=
iconReferences
.
find
(
const
matchingIcon
=
iconReferences
.
find
(
reference
=>
reference
.
parentNode
.
getAttribute
(
'
data-testid
'
)
===
`
${
iconName
}
-icon`
,
(
reference
)
=>
reference
.
parentNode
.
getAttribute
(
'
data-testid
'
)
===
`
${
iconName
}
-icon`
,
);
);
const
pass
=
Boolean
(
matchingIcon
);
const
pass
=
Boolean
(
matchingIcon
);
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
}
else
{
}
else
{
message
=
`
${
element
.
outerHTML
}
does not contain the sprite icon "
${
iconName
}
"!`
;
message
=
`
${
element
.
outerHTML
}
does not contain the sprite icon "
${
iconName
}
"!`
;
const
existingIcons
=
iconReferences
.
map
(
reference
=>
{
const
existingIcons
=
iconReferences
.
map
(
(
reference
)
=>
{
const
iconUrl
=
reference
.
getAttribute
(
'
href
'
);
const
iconUrl
=
reference
.
getAttribute
(
'
href
'
);
return
`"
${
iconUrl
.
replace
(
/^.+#/
,
''
)}
"`
;
return
`"
${
iconUrl
.
replace
(
/^.+#/
,
''
)}
"`
;
});
});
...
...
spec/frontend/matchers_spec.js
View file @
7c1fa749
...
@@ -3,7 +3,7 @@ describe('Custom jest matchers', () => {
...
@@ -3,7 +3,7 @@ describe('Custom jest matchers', () => {
describe
(
'
malformed input
'
,
()
=>
{
describe
(
'
malformed input
'
,
()
=>
{
it
.
each
([
null
,
1
,
Symbol
,
Array
,
Object
])(
it
.
each
([
null
,
1
,
Symbol
,
Array
,
Object
])(
'
fails graciously if the expected value is %s
'
,
'
fails graciously if the expected value is %s
'
,
expected
=>
{
(
expected
)
=>
{
expect
(
expected
).
not
.
toMatchInterpolatedText
(
'
null
'
);
expect
(
expected
).
not
.
toMatchInterpolatedText
(
'
null
'
);
},
},
);
);
...
@@ -11,7 +11,7 @@ describe('Custom jest matchers', () => {
...
@@ -11,7 +11,7 @@ describe('Custom jest matchers', () => {
describe
(
'
malformed matcher
'
,
()
=>
{
describe
(
'
malformed matcher
'
,
()
=>
{
it
.
each
([
null
,
1
,
Symbol
,
Array
,
Object
])(
it
.
each
([
null
,
1
,
Symbol
,
Array
,
Object
])(
'
fails graciously if the matcher is %s
'
,
'
fails graciously if the matcher is %s
'
,
matcher
=>
{
(
matcher
)
=>
{
expect
(
'
null
'
).
not
.
toMatchInterpolatedText
(
matcher
);
expect
(
'
null
'
).
not
.
toMatchInterpolatedText
(
matcher
);
},
},
);
);
...
...
spec/frontend/members/components/avatars/user_avatar_spec.js
View file @
7c1fa749
...
@@ -22,7 +22,7 @@ describe('UserAvatar', () => {
...
@@ -22,7 +22,7 @@ describe('UserAvatar', () => {
const
getByText
=
(
text
,
options
)
=>
const
getByText
=
(
text
,
options
)
=>
createWrapper
(
within
(
wrapper
.
element
).
findByText
(
text
,
options
));
createWrapper
(
within
(
wrapper
.
element
).
findByText
(
text
,
options
));
const
findStatusEmoji
=
emoji
=>
wrapper
.
find
(
`gl-emoji[data-name="
${
emoji
}
"]`
);
const
findStatusEmoji
=
(
emoji
)
=>
wrapper
.
find
(
`gl-emoji[data-name="
${
emoji
}
"]`
);
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
...
...
spec/frontend/members/components/filter_sort/filter_sort_container_spec.js
View file @
7c1fa749
...
@@ -10,7 +10,7 @@ localVue.use(Vuex);
...
@@ -10,7 +10,7 @@ localVue.use(Vuex);
describe
(
'
FilterSortContainer
'
,
()
=>
{
describe
(
'
FilterSortContainer
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
state
=>
{
const
createComponent
=
(
state
)
=>
{
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
state
:
{
state
:
{
filteredSearchBar
:
{
filteredSearchBar
:
{
...
...
spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js
View file @
7c1fa749
...
@@ -10,7 +10,7 @@ localVue.use(Vuex);
...
@@ -10,7 +10,7 @@ localVue.use(Vuex);
describe
(
'
MembersFilteredSearchBar
'
,
()
=>
{
describe
(
'
MembersFilteredSearchBar
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
state
=>
{
const
createComponent
=
(
state
)
=>
{
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
state
:
{
state
:
{
sourceId
:
1
,
sourceId
:
1
,
...
...
spec/frontend/members/components/filter_sort/sort_dropdown_spec.js
View file @
7c1fa749
...
@@ -12,7 +12,7 @@ describe('SortDropdown', () => {
...
@@ -12,7 +12,7 @@ describe('SortDropdown', () => {
const
URL_HOST
=
'
https://localhost/
'
;
const
URL_HOST
=
'
https://localhost/
'
;
const
createComponent
=
state
=>
{
const
createComponent
=
(
state
)
=>
{
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
state
:
{
state
:
{
sourceId
:
1
,
sourceId
:
1
,
...
@@ -38,10 +38,10 @@ describe('SortDropdown', () => {
...
@@ -38,10 +38,10 @@ describe('SortDropdown', () => {
const
findSortDirectionToggle
=
()
=>
const
findSortDirectionToggle
=
()
=>
findSortingComponent
().
find
(
'
button[title="Sort direction"]
'
);
findSortingComponent
().
find
(
'
button[title="Sort direction"]
'
);
const
findDropdownToggle
=
()
=>
wrapper
.
find
(
'
button[aria-haspopup="true"]
'
);
const
findDropdownToggle
=
()
=>
wrapper
.
find
(
'
button[aria-haspopup="true"]
'
);
const
findDropdownItemByText
=
text
=>
const
findDropdownItemByText
=
(
text
)
=>
wrapper
wrapper
.
findAll
(
GlSortingItem
)
.
findAll
(
GlSortingItem
)
.
wrappers
.
find
(
dropdownItemWrapper
=>
dropdownItemWrapper
.
text
()
===
text
);
.
wrappers
.
find
(
(
dropdownItemWrapper
)
=>
dropdownItemWrapper
.
text
()
===
text
);
describe
(
'
dropdown options
'
,
()
=>
{
describe
(
'
dropdown options
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -76,7 +76,7 @@ describe('SortDropdown', () => {
...
@@ -76,7 +76,7 @@ describe('SortDropdown', () => {
createComponent
();
createComponent
();
expectedDropdownItems
.
forEach
(
expectedDropdownItem
=>
{
expectedDropdownItems
.
forEach
(
(
expectedDropdownItem
)
=>
{
const
dropdownItem
=
findDropdownItemByText
(
expectedDropdownItem
.
label
);
const
dropdownItem
=
findDropdownItemByText
(
expectedDropdownItem
.
label
);
expect
(
dropdownItem
).
not
.
toBe
(
null
);
expect
(
dropdownItem
).
not
.
toBe
(
null
);
...
...
spec/frontend/members/components/modals/remove_group_link_modal_spec.js
View file @
7c1fa749
...
@@ -31,7 +31,7 @@ describe('RemoveGroupLinkModal', () => {
...
@@ -31,7 +31,7 @@ describe('RemoveGroupLinkModal', () => {
});
});
};
};
const
createComponent
=
state
=>
{
const
createComponent
=
(
state
)
=>
{
wrapper
=
mount
(
RemoveGroupLinkModal
,
{
wrapper
=
mount
(
RemoveGroupLinkModal
,
{
localVue
,
localVue
,
store
:
createStore
(
state
),
store
:
createStore
(
state
),
...
...
spec/frontend/members/components/table/created_at_spec.js
View file @
7c1fa749
...
@@ -13,7 +13,7 @@ describe('CreatedAt', () => {
...
@@ -13,7 +13,7 @@ describe('CreatedAt', () => {
let
wrapper
;
let
wrapper
;
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
mount
(
CreatedAt
,
{
wrapper
=
mount
(
CreatedAt
,
{
propsData
:
{
propsData
:
{
date
,
date
,
...
...
spec/frontend/members/components/table/expiration_datepicker_spec.js
View file @
7c1fa749
...
@@ -25,7 +25,7 @@ describe('ExpirationDatepicker', () => {
...
@@ -25,7 +25,7 @@ describe('ExpirationDatepicker', () => {
actions
=
{
actions
=
{
updateMemberExpiration
:
jest
.
fn
(
updateMemberExpiration
:
jest
.
fn
(
()
=>
()
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolveUpdateMemberExpiration
=
resolve
;
resolveUpdateMemberExpiration
=
resolve
;
}),
}),
),
),
...
...
spec/frontend/members/components/table/expires_at_spec.js
View file @
7c1fa749
...
@@ -10,7 +10,7 @@ describe('ExpiresAt', () => {
...
@@ -10,7 +10,7 @@ describe('ExpiresAt', () => {
let
wrapper
;
let
wrapper
;
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
mount
(
ExpiresAt
,
{
wrapper
=
mount
(
ExpiresAt
,
{
propsData
,
propsData
,
directives
:
{
directives
:
{
...
@@ -22,7 +22,7 @@ describe('ExpiresAt', () => {
...
@@ -22,7 +22,7 @@ describe('ExpiresAt', () => {
const
getByText
=
(
text
,
options
)
=>
const
getByText
=
(
text
,
options
)
=>
createWrapper
(
within
(
wrapper
.
element
).
getByText
(
text
,
options
));
createWrapper
(
within
(
wrapper
.
element
).
getByText
(
text
,
options
));
const
getTooltipDirective
=
elementWrapper
=>
getBinding
(
elementWrapper
.
element
,
'
gl-tooltip
'
);
const
getTooltipDirective
=
(
elementWrapper
)
=>
getBinding
(
elementWrapper
.
element
,
'
gl-tooltip
'
);
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
...
...
spec/frontend/members/components/table/member_avatar_spec.js
View file @
7c1fa749
...
@@ -9,7 +9,7 @@ import InviteAvatar from '~/members/components/avatars/invite_avatar.vue';
...
@@ -9,7 +9,7 @@ import InviteAvatar from '~/members/components/avatars/invite_avatar.vue';
describe
(
'
MemberList
'
,
()
=>
{
describe
(
'
MemberList
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
MemberAvatar
,
{
wrapper
=
shallowMount
(
MemberAvatar
,
{
propsData
:
{
propsData
:
{
isCurrentUser
:
false
,
isCurrentUser
:
false
,
...
...
spec/frontend/members/components/table/member_source_spec.js
View file @
7c1fa749
...
@@ -6,7 +6,7 @@ import MemberSource from '~/members/components/table/member_source.vue';
...
@@ -6,7 +6,7 @@ import MemberSource from '~/members/components/table/member_source.vue';
describe
(
'
MemberSource
'
,
()
=>
{
describe
(
'
MemberSource
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
mount
(
MemberSource
,
{
wrapper
=
mount
(
MemberSource
,
{
propsData
:
{
propsData
:
{
memberSource
:
{
memberSource
:
{
...
@@ -25,7 +25,7 @@ describe('MemberSource', () => {
...
@@ -25,7 +25,7 @@ describe('MemberSource', () => {
const
getByText
=
(
text
,
options
)
=>
const
getByText
=
(
text
,
options
)
=>
createWrapper
(
getByTextHelper
(
wrapper
.
element
,
text
,
options
));
createWrapper
(
getByTextHelper
(
wrapper
.
element
,
text
,
options
));
const
getTooltipDirective
=
elementWrapper
=>
getBinding
(
elementWrapper
.
element
,
'
gl-tooltip
'
);
const
getTooltipDirective
=
(
elementWrapper
)
=>
getBinding
(
elementWrapper
.
element
,
'
gl-tooltip
'
);
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
...
...
spec/frontend/members/components/table/members_table_spec.js
View file @
7c1fa749
...
@@ -39,7 +39,7 @@ describe('MembersTable', () => {
...
@@ -39,7 +39,7 @@ describe('MembersTable', () => {
});
});
};
};
const
createComponent
=
state
=>
{
const
createComponent
=
(
state
)
=>
{
wrapper
=
mount
(
MembersTable
,
{
wrapper
=
mount
(
MembersTable
,
{
localVue
,
localVue
,
store
:
createStore
(
state
),
store
:
createStore
(
state
),
...
...
spec/frontend/members/components/table/role_dropdown_spec.js
View file @
7c1fa749
...
@@ -44,7 +44,7 @@ describe('RoleDropdown', () => {
...
@@ -44,7 +44,7 @@ describe('RoleDropdown', () => {
const
getDropdownMenu
=
()
=>
within
(
wrapper
.
element
).
getByRole
(
'
menu
'
);
const
getDropdownMenu
=
()
=>
within
(
wrapper
.
element
).
getByRole
(
'
menu
'
);
const
getByTextInDropdownMenu
=
(
text
,
options
=
{})
=>
const
getByTextInDropdownMenu
=
(
text
,
options
=
{})
=>
createWrapper
(
within
(
getDropdownMenu
()).
getByText
(
text
,
options
));
createWrapper
(
within
(
getDropdownMenu
()).
getByText
(
text
,
options
));
const
getDropdownItemByText
=
text
=>
const
getDropdownItemByText
=
(
text
)
=>
createWrapper
(
createWrapper
(
within
(
getDropdownMenu
())
within
(
getDropdownMenu
())
.
getByText
(
text
,
{
selector
:
'
[role="menuitem"] p
'
})
.
getByText
(
text
,
{
selector
:
'
[role="menuitem"] p
'
})
...
@@ -53,7 +53,7 @@ describe('RoleDropdown', () => {
...
@@ -53,7 +53,7 @@ describe('RoleDropdown', () => {
const
getCheckedDropdownItem
=
()
=>
const
getCheckedDropdownItem
=
()
=>
wrapper
wrapper
.
findAll
(
GlDropdownItem
)
.
findAll
(
GlDropdownItem
)
.
wrappers
.
find
(
dropdownItemWrapper
=>
dropdownItemWrapper
.
props
(
'
isChecked
'
));
.
wrappers
.
find
(
(
dropdownItemWrapper
)
=>
dropdownItemWrapper
.
props
(
'
isChecked
'
));
const
findDropdownToggle
=
()
=>
wrapper
.
find
(
'
button[aria-haspopup="true"]
'
);
const
findDropdownToggle
=
()
=>
wrapper
.
find
(
'
button[aria-haspopup="true"]
'
);
const
findDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
findDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
...
@@ -63,7 +63,7 @@ describe('RoleDropdown', () => {
...
@@ -63,7 +63,7 @@ describe('RoleDropdown', () => {
});
});
describe
(
'
when dropdown is open
'
,
()
=>
{
describe
(
'
when dropdown is open
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
();
createComponent
();
findDropdownToggle
().
trigger
(
'
click
'
);
findDropdownToggle
().
trigger
(
'
click
'
);
...
@@ -73,7 +73,7 @@ describe('RoleDropdown', () => {
...
@@ -73,7 +73,7 @@ describe('RoleDropdown', () => {
});
});
it
(
'
renders all valid roles
'
,
()
=>
{
it
(
'
renders all valid roles
'
,
()
=>
{
Object
.
keys
(
member
.
validRoles
).
forEach
(
role
=>
{
Object
.
keys
(
member
.
validRoles
).
forEach
(
(
role
)
=>
{
expect
(
getDropdownItemByText
(
role
).
exists
()).
toBe
(
true
);
expect
(
getDropdownItemByText
(
role
).
exists
()).
toBe
(
true
);
});
});
});
});
...
...
spec/frontend/members/utils_spec.js
View file @
7c1fa749
...
@@ -24,7 +24,7 @@ describe('Members Utils', () => {
...
@@ -24,7 +24,7 @@ describe('Members Utils', () => {
it
(
'
has correct properties for each badge
'
,
()
=>
{
it
(
'
has correct properties for each badge
'
,
()
=>
{
const
badges
=
generateBadges
(
memberMock
,
true
);
const
badges
=
generateBadges
(
memberMock
,
true
);
badges
.
forEach
(
badge
=>
{
badges
.
forEach
(
(
badge
)
=>
{
expect
(
badge
).
toEqual
(
expect
(
badge
).
toEqual
(
expect
.
objectContaining
({
expect
.
objectContaining
({
show
:
expect
.
any
(
Boolean
),
show
:
expect
.
any
(
Boolean
),
...
...
spec/frontend/merge_request_spec.js
View file @
7c1fa749
...
@@ -28,7 +28,7 @@ describe('MergeRequest', () => {
...
@@ -28,7 +28,7 @@ describe('MergeRequest', () => {
mock
.
restore
();
mock
.
restore
();
});
});
it
(
'
modifies the Markdown field
'
,
done
=>
{
it
(
'
modifies the Markdown field
'
,
(
done
)
=>
{
jest
.
spyOn
(
$
,
'
ajax
'
).
mockImplementation
();
jest
.
spyOn
(
$
,
'
ajax
'
).
mockImplementation
();
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
changeEvent
.
initEvent
(
'
change
'
,
true
,
true
);
changeEvent
.
initEvent
(
'
change
'
,
true
,
true
);
...
@@ -41,7 +41,7 @@ describe('MergeRequest', () => {
...
@@ -41,7 +41,7 @@ describe('MergeRequest', () => {
});
});
});
});
it
(
'
ensure that task with only spaces does not get checked incorrectly
'
,
done
=>
{
it
(
'
ensure that task with only spaces does not get checked incorrectly
'
,
(
done
)
=>
{
// fixed in 'deckar01-task_list', '2.2.1' gem
// fixed in 'deckar01-task_list', '2.2.1' gem
jest
.
spyOn
(
$
,
'
ajax
'
).
mockImplementation
();
jest
.
spyOn
(
$
,
'
ajax
'
).
mockImplementation
();
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
const
changeEvent
=
document
.
createEvent
(
'
HTMLEvents
'
);
...
@@ -61,7 +61,7 @@ describe('MergeRequest', () => {
...
@@ -61,7 +61,7 @@ describe('MergeRequest', () => {
const
index
=
3
;
const
index
=
3
;
const
checked
=
true
;
const
checked
=
true
;
it
(
'
submits an ajax request on tasklist:changed
'
,
done
=>
{
it
(
'
submits an ajax request on tasklist:changed
'
,
(
done
)
=>
{
$
(
'
.js-task-list-field
'
).
trigger
({
$
(
'
.js-task-list-field
'
).
trigger
({
type
:
'
tasklist:changed
'
,
type
:
'
tasklist:changed
'
,
detail
:
{
lineNumber
,
lineSource
,
index
,
checked
},
detail
:
{
lineNumber
,
lineSource
,
index
,
checked
},
...
@@ -83,7 +83,7 @@ describe('MergeRequest', () => {
...
@@ -83,7 +83,7 @@ describe('MergeRequest', () => {
});
});
});
});
it
(
'
shows an error notification when tasklist update failed
'
,
done
=>
{
it
(
'
shows an error notification when tasklist update failed
'
,
(
done
)
=>
{
mock
mock
.
onPatch
(
`
${
TEST_HOST
}
/frontend-fixtures/merge-requests-project/-/merge_requests/1.json`
)
.
onPatch
(
`
${
TEST_HOST
}
/frontend-fixtures/merge-requests-project/-/merge_requests/1.json`
)
.
reply
(
409
,
{});
.
reply
(
409
,
{});
...
...
spec/frontend/merge_request_tabs_spec.js
View file @
7c1fa749
...
@@ -14,7 +14,7 @@ jest.mock('~/lib/utils/webpack', () => ({
...
@@ -14,7 +14,7 @@ jest.mock('~/lib/utils/webpack', () => ({
describe
(
'
MergeRequestTabs
'
,
()
=>
{
describe
(
'
MergeRequestTabs
'
,
()
=>
{
const
testContext
=
{};
const
testContext
=
{};
const
stubLocation
=
{};
const
stubLocation
=
{};
const
setLocation
=
stubs
=>
{
const
setLocation
=
(
stubs
)
=>
{
const
defaults
=
{
const
defaults
=
{
pathname
:
''
,
pathname
:
''
,
search
:
''
,
search
:
''
,
...
@@ -265,7 +265,7 @@ describe('MergeRequestTabs', () => {
...
@@ -265,7 +265,7 @@ describe('MergeRequestTabs', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
mainContent
,
'
getBoundingClientRect
'
).
mockReturnValue
({
top
:
10
});
jest
.
spyOn
(
mainContent
,
'
getBoundingClientRect
'
).
mockReturnValue
({
top
:
10
});
jest
.
spyOn
(
tabContent
,
'
getBoundingClientRect
'
).
mockReturnValue
({
top
:
100
});
jest
.
spyOn
(
tabContent
,
'
getBoundingClientRect
'
).
mockReturnValue
({
top
:
100
});
jest
.
spyOn
(
document
,
'
querySelector
'
).
mockImplementation
(
selector
=>
{
jest
.
spyOn
(
document
,
'
querySelector
'
).
mockImplementation
(
(
selector
)
=>
{
return
selector
===
'
.content-wrapper
'
?
mainContent
:
tabContent
;
return
selector
===
'
.content-wrapper
'
?
mainContent
:
tabContent
;
});
});
testContext
.
class
.
currentAction
=
'
commits
'
;
testContext
.
class
.
currentAction
=
'
commits
'
;
...
...
spec/frontend/milestones/milestone_combobox_spec.js
View file @
7c1fa749
...
@@ -41,7 +41,7 @@ describe('Milestone combobox component', () => {
...
@@ -41,7 +41,7 @@ describe('Milestone combobox component', () => {
attrs
,
attrs
,
listeners
:
{
listeners
:
{
// simulate a parent component v-model binding
// simulate a parent component v-model binding
input
:
selectedMilestone
=>
{
input
:
(
selectedMilestone
)
=>
{
wrapper
.
setProps
({
value
:
selectedMilestone
});
wrapper
.
setProps
({
value
:
selectedMilestone
});
},
},
},
},
...
@@ -71,13 +71,13 @@ describe('Milestone combobox component', () => {
...
@@ -71,13 +71,13 @@ describe('Milestone combobox component', () => {
mock
mock
.
onGet
(
`/api/v4/projects/
${
projectId
}
/milestones`
)
.
onGet
(
`/api/v4/projects/
${
projectId
}
/milestones`
)
.
reply
(
config
=>
projectMilestonesApiCallSpy
(
config
));
.
reply
(
(
config
)
=>
projectMilestonesApiCallSpy
(
config
));
mock
mock
.
onGet
(
`/api/v4/groups/
${
groupId
}
/milestones`
)
.
onGet
(
`/api/v4/groups/
${
groupId
}
/milestones`
)
.
reply
(
config
=>
groupMilestonesApiCallSpy
(
config
));
.
reply
(
(
config
)
=>
groupMilestonesApiCallSpy
(
config
));
mock
.
onGet
(
`/api/v4/projects/
${
projectId
}
/search`
).
reply
(
config
=>
searchApiCallSpy
(
config
));
mock
.
onGet
(
`/api/v4/projects/
${
projectId
}
/search`
).
reply
(
(
config
)
=>
searchApiCallSpy
(
config
));
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -129,7 +129,7 @@ describe('Milestone combobox component', () => {
...
@@ -129,7 +129,7 @@ describe('Milestone combobox component', () => {
//
//
// Convenience methods
// Convenience methods
//
//
const
updateQuery
=
newQuery
=>
{
const
updateQuery
=
(
newQuery
)
=>
{
findSearchBox
().
vm
.
$emit
(
'
input
'
,
newQuery
);
findSearchBox
().
vm
.
$emit
(
'
input
'
,
newQuery
);
};
};
...
...
spec/frontend/mini_pipeline_graph_dropdown_spec.js
View file @
7c1fa749
...
@@ -64,7 +64,7 @@ describe('Mini Pipeline Graph Dropdown', () => {
...
@@ -64,7 +64,7 @@ describe('Mini Pipeline Graph Dropdown', () => {
expect
(
ajaxSpy
.
mock
.
calls
[
0
][
0
]).
toEqual
(
'
foobar
'
);
expect
(
ajaxSpy
.
mock
.
calls
[
0
][
0
]).
toEqual
(
'
foobar
'
);
});
});
it
(
'
should not close when user uses cmd/ctrl + click
'
,
done
=>
{
it
(
'
should not close when user uses cmd/ctrl + click
'
,
(
done
)
=>
{
mock
.
onGet
(
'
foobar
'
).
reply
(
200
,
{
mock
.
onGet
(
'
foobar
'
).
reply
(
200
,
{
html
:
`<li>
html
:
`<li>
<a class="mini-pipeline-graph-dropdown-item" href="#">
<a class="mini-pipeline-graph-dropdown-item" href="#">
...
@@ -90,7 +90,7 @@ describe('Mini Pipeline Graph Dropdown', () => {
...
@@ -90,7 +90,7 @@ describe('Mini Pipeline Graph Dropdown', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
should close the dropdown when request returns an error
'
,
done
=>
{
it
(
'
should close the dropdown when request returns an error
'
,
(
done
)
=>
{
mock
.
onGet
(
'
foobar
'
).
networkError
();
mock
.
onGet
(
'
foobar
'
).
networkError
();
new
MiniPipelineGraph
({
container
:
'
.js-builds-dropdown-tests
'
}).
bindEvents
();
new
MiniPipelineGraph
({
container
:
'
.js-builds-dropdown-tests
'
}).
bindEvents
();
...
...
spec/frontend/mocks/ce/lib/utils/axios_utils.js
View file @
7c1fa749
...
@@ -5,7 +5,7 @@ const axios = jest.requireActual('~/lib/utils/axios_utils').default;
...
@@ -5,7 +5,7 @@ const axios = jest.requireActual('~/lib/utils/axios_utils').default;
axios
.
isMock
=
true
;
axios
.
isMock
=
true
;
// Fail tests for unmocked requests
// Fail tests for unmocked requests
axios
.
defaults
.
adapter
=
config
=>
{
axios
.
defaults
.
adapter
=
(
config
)
=>
{
const
message
=
const
message
=
`Unexpected unmocked request:
${
JSON
.
stringify
(
config
,
null
,
2
)}
\n`
+
`Unexpected unmocked request:
${
JSON
.
stringify
(
config
,
null
,
2
)}
\n`
+
'
Consider using the `axios-mock-adapter` module in tests.
'
;
'
Consider using the `axios-mock-adapter` module in tests.
'
;
...
@@ -23,7 +23,7 @@ const onRequest = () => {
...
@@ -23,7 +23,7 @@ const onRequest = () => {
};
};
// Use setImmediate to alloow the response interceptor to finish
// Use setImmediate to alloow the response interceptor to finish
const
onResponse
=
config
=>
{
const
onResponse
=
(
config
)
=>
{
activeRequests
-=
1
;
activeRequests
-=
1
;
setImmediate
(()
=>
{
setImmediate
(()
=>
{
events
.
emit
(
'
response
'
,
config
);
events
.
emit
(
'
response
'
,
config
);
...
@@ -31,7 +31,7 @@ const onResponse = config => {
...
@@ -31,7 +31,7 @@ const onResponse = config => {
};
};
const
subscribeToResponse
=
(
predicate
=
()
=>
true
)
=>
const
subscribeToResponse
=
(
predicate
=
()
=>
true
)
=>
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
const
listener
=
(
config
=
{})
=>
{
const
listener
=
(
config
=
{})
=>
{
if
(
predicate
(
config
))
{
if
(
predicate
(
config
))
{
events
.
off
(
'
response
'
,
listener
);
events
.
off
(
'
response
'
,
listener
);
...
@@ -49,7 +49,7 @@ const subscribeToResponse = (predicate = () => true) =>
...
@@ -49,7 +49,7 @@ const subscribeToResponse = (predicate = () => true) =>
/**
/**
* Registers a callback function to be run after a request to the given URL finishes.
* Registers a callback function to be run after a request to the given URL finishes.
*/
*/
axios
.
waitFor
=
url
=>
subscribeToResponse
(({
url
:
configUrl
})
=>
configUrl
===
url
);
axios
.
waitFor
=
(
url
)
=>
subscribeToResponse
(({
url
:
configUrl
})
=>
configUrl
===
url
);
/**
/**
* Registers a callback function to be run after all requests have finished. If there are no requests waiting, the callback is executed immediately.
* Registers a callback function to be run after all requests have finished. If there are no requests waiting, the callback is executed immediately.
...
@@ -58,18 +58,18 @@ axios.waitForAll = () => subscribeToResponse(() => activeRequests === 0);
...
@@ -58,18 +58,18 @@ axios.waitForAll = () => subscribeToResponse(() => activeRequests === 0);
axios
.
countActiveRequests
=
()
=>
activeRequests
;
axios
.
countActiveRequests
=
()
=>
activeRequests
;
axios
.
interceptors
.
request
.
use
(
config
=>
{
axios
.
interceptors
.
request
.
use
(
(
config
)
=>
{
onRequest
();
onRequest
();
return
config
;
return
config
;
});
});
// Remove the global counter
// Remove the global counter
axios
.
interceptors
.
response
.
use
(
axios
.
interceptors
.
response
.
use
(
response
=>
{
(
response
)
=>
{
onResponse
(
response
.
config
);
onResponse
(
response
.
config
);
return
response
;
return
response
;
},
},
err
=>
{
(
err
)
=>
{
onResponse
(
err
.
config
);
onResponse
(
err
.
config
);
return
Promise
.
reject
(
err
);
return
Promise
.
reject
(
err
);
},
},
...
...
spec/frontend/mocks/mocks_helper.js
View file @
7c1fa749
...
@@ -19,9 +19,9 @@ const prefixMap = [
...
@@ -19,9 +19,9 @@ const prefixMap = [
// { mocksRoot: 'virtual', requirePrefix: '' }, // We'll deal with virtual mocks later
// { mocksRoot: 'virtual', requirePrefix: '' }, // We'll deal with virtual mocks later
];
];
const
mockFileFilter
=
stats
=>
stats
.
isFile
()
&&
stats
.
path
.
endsWith
(
'
.js
'
);
const
mockFileFilter
=
(
stats
)
=>
stats
.
isFile
()
&&
stats
.
path
.
endsWith
(
'
.js
'
);
const
getMockFiles
=
root
=>
readdir
.
sync
(
root
,
{
deep
:
MAX_DEPTH
,
filter
:
mockFileFilter
});
const
getMockFiles
=
(
root
)
=>
readdir
.
sync
(
root
,
{
deep
:
MAX_DEPTH
,
filter
:
mockFileFilter
});
// Function that performs setting a mock. This has to be overridden by the unit test, because
// Function that performs setting a mock. This has to be overridden by the unit test, because
// jest.setMock can't be overwritten across files.
// jest.setMock can't be overwritten across files.
...
@@ -36,7 +36,7 @@ export const setupManualMocks = function setupManualMocks(setMock = defaultSetMo
...
@@ -36,7 +36,7 @@ export const setupManualMocks = function setupManualMocks(setMock = defaultSetMo
return
;
return
;
}
}
getMockFiles
(
path
.
join
(
__dirname
,
mocksRoot
)).
forEach
(
mockPath
=>
{
getMockFiles
(
path
.
join
(
__dirname
,
mocksRoot
)).
forEach
(
(
mockPath
)
=>
{
const
mockPathNoExt
=
mockPath
.
substring
(
0
,
mockPath
.
length
-
path
.
extname
(
mockPath
).
length
);
const
mockPathNoExt
=
mockPath
.
substring
(
0
,
mockPath
.
length
-
path
.
extname
(
mockPath
).
length
);
const
sourcePath
=
path
.
join
(
requirePrefix
,
mockPathNoExt
);
const
sourcePath
=
path
.
join
(
requirePrefix
,
mockPathNoExt
);
const
mockPathRelative
=
`./
${
path
.
join
(
mocksRoot
,
mockPathNoExt
)}
`
;
const
mockPathRelative
=
`./
${
path
.
join
(
mocksRoot
,
mockPathNoExt
)}
`
;
...
...
spec/frontend/mocks/mocks_helper_spec.js
View file @
7c1fa749
...
@@ -47,13 +47,13 @@ describe('mocks_helper.js', () => {
...
@@ -47,13 +47,13 @@ describe('mocks_helper.js', () => {
const
readdirSpy
=
readdir
.
sync
;
const
readdirSpy
=
readdir
.
sync
;
expect
(
readdirSpy
).
toHaveBeenCalled
();
expect
(
readdirSpy
).
toHaveBeenCalled
();
readdirSpy
.
mock
.
calls
.
forEach
(
call
=>
{
readdirSpy
.
mock
.
calls
.
forEach
(
(
call
)
=>
{
expect
(
call
[
1
].
deep
).
toBeLessThan
(
100
);
expect
(
call
[
1
].
deep
).
toBeLessThan
(
100
);
});
});
});
});
it
(
'
sets up mocks for CE (the ~/ prefix)
'
,
()
=>
{
it
(
'
sets up mocks for CE (the ~/ prefix)
'
,
()
=>
{
fs
.
existsSync
.
mockImplementation
(
root
=>
root
.
endsWith
(
'
ce
'
));
fs
.
existsSync
.
mockImplementation
(
(
root
)
=>
root
.
endsWith
(
'
ce
'
));
readdir
.
sync
.
mockReturnValue
([
'
root.js
'
,
'
lib/utils/util.js
'
]);
readdir
.
sync
.
mockReturnValue
([
'
root.js
'
,
'
lib/utils/util.js
'
]);
setupManualMocks
();
setupManualMocks
();
...
@@ -72,7 +72,7 @@ describe('mocks_helper.js', () => {
...
@@ -72,7 +72,7 @@ describe('mocks_helper.js', () => {
};
};
fs
.
existsSync
.
mockReturnValue
(
true
);
fs
.
existsSync
.
mockReturnValue
(
true
);
readdir
.
sync
.
mockImplementation
(
root
=>
files
[
root
]);
readdir
.
sync
.
mockImplementation
(
(
root
)
=>
files
[
root
]);
setupManualMocks
();
setupManualMocks
();
expect
(
readdir
.
sync
).
toHaveBeenCalledTimes
(
1
);
expect
(
readdir
.
sync
).
toHaveBeenCalledTimes
(
1
);
...
@@ -84,7 +84,7 @@ describe('mocks_helper.js', () => {
...
@@ -84,7 +84,7 @@ describe('mocks_helper.js', () => {
});
});
it
(
'
fails when given a virtual mock
'
,
()
=>
{
it
(
'
fails when given a virtual mock
'
,
()
=>
{
fs
.
existsSync
.
mockImplementation
(
p
=>
p
.
endsWith
(
'
ce
'
));
fs
.
existsSync
.
mockImplementation
(
(
p
)
=>
p
.
endsWith
(
'
ce
'
));
readdir
.
sync
.
mockReturnValue
([
'
virtual
'
,
'
shouldntBeImported
'
]);
readdir
.
sync
.
mockReturnValue
([
'
virtual
'
,
'
shouldntBeImported
'
]);
setMock
.
mockImplementation
(()
=>
{
setMock
.
mockImplementation
(()
=>
{
throw
new
Error
(
'
Could not locate module
'
);
throw
new
Error
(
'
Could not locate module
'
);
...
@@ -106,7 +106,7 @@ describe('mocks_helper.js', () => {
...
@@ -106,7 +106,7 @@ describe('mocks_helper.js', () => {
});
});
});
});
it
(
'
survives jest.isolateModules()
'
,
done
=>
{
it
(
'
survives jest.isolateModules()
'
,
(
done
)
=>
{
jest
.
isolateModules
(()
=>
{
jest
.
isolateModules
(()
=>
{
const
axios2
=
require
(
'
~/lib/utils/axios_utils
'
).
default
;
const
axios2
=
require
(
'
~/lib/utils/axios_utils
'
).
default
;
expect
(
axios2
.
isMock
).
toBe
(
true
);
expect
(
axios2
.
isMock
).
toBe
(
true
);
...
...
spec/frontend/monitoring/alert_widget_spec.js
View file @
7c1fa749
...
@@ -83,7 +83,7 @@ describe('AlertWidget', () => {
...
@@ -83,7 +83,7 @@ describe('AlertWidget', () => {
},
},
};
};
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
AlertWidget
,
{
wrapper
=
shallowMount
(
AlertWidget
,
{
stubs
:
{
GlTooltip
,
GlSprintf
},
stubs
:
{
GlTooltip
,
GlSprintf
},
propsData
:
{
propsData
:
{
...
@@ -108,7 +108,7 @@ describe('AlertWidget', () => {
...
@@ -108,7 +108,7 @@ describe('AlertWidget', () => {
it
(
'
displays a loading spinner and disables form when fetching alerts
'
,
()
=>
{
it
(
'
displays a loading spinner and disables form when fetching alerts
'
,
()
=>
{
let
resolveReadAlert
;
let
resolveReadAlert
;
mockReadAlert
.
mockReturnValue
(
mockReadAlert
.
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolveReadAlert
=
resolve
;
resolveReadAlert
=
resolve
;
}),
}),
);
);
...
@@ -131,7 +131,7 @@ describe('AlertWidget', () => {
...
@@ -131,7 +131,7 @@ describe('AlertWidget', () => {
it
(
'
does not render loading spinner if showLoadingState is false
'
,
()
=>
{
it
(
'
does not render loading spinner if showLoadingState is false
'
,
()
=>
{
let
resolveReadAlert
;
let
resolveReadAlert
;
mockReadAlert
.
mockReturnValue
(
mockReadAlert
.
mockReturnValue
(
new
Promise
(
resolve
=>
{
new
Promise
(
(
resolve
)
=>
{
resolveReadAlert
=
resolve
;
resolveReadAlert
=
resolve
;
}),
}),
);
);
...
...
spec/frontend/monitoring/components/charts/annotations_spec.js
View file @
7c1fa749
...
@@ -36,7 +36,7 @@ describe('annotations spec', () => {
...
@@ -36,7 +36,7 @@ describe('annotations spec', () => {
}),
}),
);
);
annotations
.
data
.
forEach
(
annotation
=>
{
annotations
.
data
.
forEach
(
(
annotation
)
=>
{
expect
(
annotation
).
toEqual
(
expect
.
any
(
Object
));
expect
(
annotation
).
toEqual
(
expect
.
any
(
Object
));
});
});
...
@@ -58,7 +58,7 @@ describe('annotations spec', () => {
...
@@ -58,7 +58,7 @@ describe('annotations spec', () => {
}),
}),
);
);
annotations
.
markLine
.
data
.
forEach
(
annotation
=>
{
annotations
.
markLine
.
data
.
forEach
(
(
annotation
)
=>
{
expect
(
annotation
).
toEqual
(
expect
.
any
(
Object
));
expect
(
annotation
).
toEqual
(
expect
.
any
(
Object
));
});
});
...
@@ -83,7 +83,7 @@ describe('annotations spec', () => {
...
@@ -83,7 +83,7 @@ describe('annotations spec', () => {
}),
}),
);
);
annotations
.
markLine
.
data
.
forEach
(
annotation
=>
{
annotations
.
markLine
.
data
.
forEach
(
(
annotation
)
=>
{
expect
(
annotation
).
toEqual
(
expect
.
any
(
Object
));
expect
(
annotation
).
toEqual
(
expect
.
any
(
Object
));
});
});
...
...
spec/frontend/monitoring/components/charts/anomaly_spec.js
View file @
7c1fa749
...
@@ -15,7 +15,7 @@ const TEST_LOWER = 9;
...
@@ -15,7 +15,7 @@ const TEST_LOWER = 9;
describe
(
'
Anomaly chart component
'
,
()
=>
{
describe
(
'
Anomaly chart component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
setupAnomalyChart
=
props
=>
{
const
setupAnomalyChart
=
(
props
)
=>
{
wrapper
=
shallowMount
(
Anomaly
,
{
wrapper
=
shallowMount
(
Anomaly
,
{
propsData
:
{
...
props
},
propsData
:
{
...
props
},
});
});
...
@@ -91,7 +91,7 @@ describe('Anomaly chart component', () => {
...
@@ -91,7 +91,7 @@ describe('Anomaly chart component', () => {
expect
(
series
.
length
).
toEqual
(
2
);
// 1 upper + 1 lower boundaries
expect
(
series
.
length
).
toEqual
(
2
);
// 1 upper + 1 lower boundaries
expect
(
series
[
0
].
stack
).
toEqual
(
series
[
1
].
stack
);
expect
(
series
[
0
].
stack
).
toEqual
(
series
[
1
].
stack
);
series
.
forEach
(
s
=>
{
series
.
forEach
(
(
s
)
=>
{
expect
(
s
.
type
).
toBe
(
'
line
'
);
expect
(
s
.
type
).
toBe
(
'
line
'
);
expect
(
s
.
lineStyle
.
width
).
toBe
(
0
);
expect
(
s
.
lineStyle
.
width
).
toBe
(
0
);
expect
(
s
.
lineStyle
.
color
).
toMatch
(
/rgba
\(
.+
\)
/
);
expect
(
s
.
lineStyle
.
color
).
toMatch
(
/rgba
\(
.+
\)
/
);
...
...
spec/frontend/monitoring/components/charts/bar_spec.js
View file @
7c1fa749
...
@@ -44,7 +44,7 @@ describe('Bar component', () => {
...
@@ -44,7 +44,7 @@ describe('Bar component', () => {
it
(
'
should return chartData as array of arrays
'
,
()
=>
{
it
(
'
should return chartData as array of arrays
'
,
()
=>
{
expect
(
chartData
).
toBeInstanceOf
(
Array
);
expect
(
chartData
).
toBeInstanceOf
(
Array
);
chartData
.
forEach
(
item
=>
{
chartData
.
forEach
(
(
item
)
=>
{
expect
(
item
).
toBeInstanceOf
(
Array
);
expect
(
item
).
toBeInstanceOf
(
Array
);
});
});
});
});
...
...
spec/frontend/monitoring/components/charts/column_spec.js
View file @
7c1fa749
...
@@ -45,7 +45,7 @@ describe('Column component', () => {
...
@@ -45,7 +45,7 @@ describe('Column component', () => {
});
});
};
};
const
findChart
=
()
=>
wrapper
.
find
(
GlColumnChart
);
const
findChart
=
()
=>
wrapper
.
find
(
GlColumnChart
);
const
chartProps
=
prop
=>
findChart
().
props
(
prop
);
const
chartProps
=
(
prop
)
=>
findChart
().
props
(
prop
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createWrapper
();
createWrapper
();
...
@@ -58,7 +58,7 @@ describe('Column component', () => {
...
@@ -58,7 +58,7 @@ describe('Column component', () => {
describe
(
'
xAxisLabel
'
,
()
=>
{
describe
(
'
xAxisLabel
'
,
()
=>
{
const
mockDate
=
Date
.
UTC
(
2020
,
4
,
26
,
20
);
// 8:00 PM in GMT
const
mockDate
=
Date
.
UTC
(
2020
,
4
,
26
,
20
);
// 8:00 PM in GMT
const
useXAxisFormatter
=
date
=>
{
const
useXAxisFormatter
=
(
date
)
=>
{
const
{
xAxis
}
=
chartProps
(
'
option
'
);
const
{
xAxis
}
=
chartProps
(
'
option
'
);
const
{
formatter
}
=
xAxis
.
axisLabel
;
const
{
formatter
}
=
xAxis
.
axisLabel
;
return
formatter
(
date
);
return
formatter
(
date
);
...
...
spec/frontend/monitoring/components/charts/gauge_spec.js
View file @
7c1fa749
...
@@ -49,7 +49,7 @@ describe('Gauge Chart component', () => {
...
@@ -49,7 +49,7 @@ describe('Gauge Chart component', () => {
it
.
each
(
invalidCases
)(
it
.
each
(
invalidCases
)(
'
if min has invalid value, defaults are used for both min and max
'
,
'
if min has invalid value, defaults are used for both min and max
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
createWrapper
({
minValue
:
invalidValue
});
createWrapper
({
minValue
:
invalidValue
});
expect
(
findGaugeChart
().
props
(
'
min
'
)).
toBe
(
MIN_DEFAULT
);
expect
(
findGaugeChart
().
props
(
'
min
'
)).
toBe
(
MIN_DEFAULT
);
...
@@ -59,7 +59,7 @@ describe('Gauge Chart component', () => {
...
@@ -59,7 +59,7 @@ describe('Gauge Chart component', () => {
it
.
each
(
invalidCases
)(
it
.
each
(
invalidCases
)(
'
if max has invalid value, defaults are used for both min and max
'
,
'
if max has invalid value, defaults are used for both min and max
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
createWrapper
({
minValue
:
invalidValue
});
createWrapper
({
minValue
:
invalidValue
});
expect
(
findGaugeChart
().
props
(
'
min
'
)).
toBe
(
MIN_DEFAULT
);
expect
(
findGaugeChart
().
props
(
'
min
'
)).
toBe
(
MIN_DEFAULT
);
...
...
spec/frontend/monitoring/components/charts/options_spec.js
View file @
7c1fa749
...
@@ -145,7 +145,7 @@ describe('options spec', () => {
...
@@ -145,7 +145,7 @@ describe('options spec', () => {
expect
(
thresholds
).
toEqual
([]);
expect
(
thresholds
).
toEqual
([]);
});
});
it
.
each
(
invalidCases
)(
'
invalid values for thresholds are filtered out
'
,
invalidValue
=>
{
it
.
each
(
invalidCases
)(
'
invalid values for thresholds are filtered out
'
,
(
invalidValue
)
=>
{
thresholds
=
getValidThresholds
({
thresholds
=
getValidThresholds
({
mode
:
'
absolute
'
,
mode
:
'
absolute
'
,
range
:
{
min
:
0
,
max
:
100
},
range
:
{
min
:
0
,
max
:
100
},
...
@@ -197,7 +197,7 @@ describe('options spec', () => {
...
@@ -197,7 +197,7 @@ describe('options spec', () => {
it
.
each
(
invalidCases
)(
it
.
each
(
invalidCases
)(
'
when min has invalid value, empty result is returned
'
,
'
when min has invalid value, empty result is returned
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
thresholds
=
getValidThresholds
({
thresholds
=
getValidThresholds
({
mode
:
'
absolute
'
,
mode
:
'
absolute
'
,
range
:
{
min
:
invalidValue
,
max
:
100
},
range
:
{
min
:
invalidValue
,
max
:
100
},
...
@@ -210,7 +210,7 @@ describe('options spec', () => {
...
@@ -210,7 +210,7 @@ describe('options spec', () => {
it
.
each
(
invalidCases
)(
it
.
each
(
invalidCases
)(
'
when max has invalid value, empty result is returned
'
,
'
when max has invalid value, empty result is returned
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
thresholds
=
getValidThresholds
({
thresholds
=
getValidThresholds
({
mode
:
'
absolute
'
,
mode
:
'
absolute
'
,
range
:
{
min
:
0
,
max
:
invalidValue
},
range
:
{
min
:
0
,
max
:
invalidValue
},
...
@@ -244,7 +244,7 @@ describe('options spec', () => {
...
@@ -244,7 +244,7 @@ describe('options spec', () => {
it
.
each
(
invalidCases
)(
it
.
each
(
invalidCases
)(
'
if invalid values are passed, empty result is returned
'
,
'
if invalid values are passed, empty result is returned
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
thresholds
=
getValidThresholds
({
thresholds
=
getValidThresholds
({
mode
:
'
absolute
'
,
mode
:
'
absolute
'
,
range
:
{
min
:
0
,
max
:
100
},
range
:
{
min
:
0
,
max
:
100
},
...
@@ -259,7 +259,7 @@ describe('options spec', () => {
...
@@ -259,7 +259,7 @@ describe('options spec', () => {
describe
(
'
mode
'
,
()
=>
{
describe
(
'
mode
'
,
()
=>
{
it
.
each
(
invalidCases
)(
it
.
each
(
invalidCases
)(
'
if invalid values are passed, empty result is returned
'
,
'
if invalid values are passed, empty result is returned
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
thresholds
=
getValidThresholds
({
thresholds
=
getValidThresholds
({
mode
:
invalidValue
,
mode
:
invalidValue
,
range
:
{
min
:
0
,
max
:
100
},
range
:
{
min
:
0
,
max
:
100
},
...
@@ -305,7 +305,7 @@ describe('options spec', () => {
...
@@ -305,7 +305,7 @@ describe('options spec', () => {
const
outOfPercentBoundsValues
=
[
-
1
,
0
,
100
,
101
];
const
outOfPercentBoundsValues
=
[
-
1
,
0
,
100
,
101
];
it
.
each
(
outOfPercentBoundsValues
)(
it
.
each
(
outOfPercentBoundsValues
)(
'
when values out of 0-100 range are passed, empty result is returned
'
,
'
when values out of 0-100 range are passed, empty result is returned
'
,
invalidValue
=>
{
(
invalidValue
)
=>
{
thresholds
=
getValidThresholds
({
thresholds
=
getValidThresholds
({
mode
:
'
percentage
'
,
mode
:
'
percentage
'
,
range
:
{
min
:
0
,
max
:
1000
},
range
:
{
min
:
0
,
max
:
1000
},
...
...
spec/frontend/monitoring/components/charts/stacked_column_spec.js
View file @
7c1fa749
...
@@ -6,7 +6,7 @@ import StackedColumnChart from '~/monitoring/components/charts/stacked_column.vu
...
@@ -6,7 +6,7 @@ import StackedColumnChart from '~/monitoring/components/charts/stacked_column.vu
import
{
stackedColumnGraphData
}
from
'
../../graph_data
'
;
import
{
stackedColumnGraphData
}
from
'
../../graph_data
'
;
jest
.
mock
(
'
~/lib/utils/icon_utils
'
,
()
=>
({
jest
.
mock
(
'
~/lib/utils/icon_utils
'
,
()
=>
({
getSvgIconPathContent
:
jest
.
fn
().
mockImplementation
(
icon
=>
Promise
.
resolve
(
`
${
icon
}
-content`
)),
getSvgIconPathContent
:
jest
.
fn
().
mockImplementation
(
(
icon
)
=>
Promise
.
resolve
(
`
${
icon
}
-content`
)),
}));
}));
describe
(
'
Stacked column chart component
'
,
()
=>
{
describe
(
'
Stacked column chart component
'
,
()
=>
{
...
@@ -48,7 +48,7 @@ describe('Stacked column chart component', () => {
...
@@ -48,7 +48,7 @@ describe('Stacked column chart component', () => {
data
.
forEach
((
series
,
index
)
=>
{
data
.
forEach
((
series
,
index
)
=>
{
const
{
values
}
=
stackedColumnMockedData
.
metrics
[
index
].
result
[
0
];
const
{
values
}
=
stackedColumnMockedData
.
metrics
[
index
].
result
[
0
];
expect
(
series
.
data
).
toEqual
(
values
.
map
(
value
=>
value
[
1
]));
expect
(
series
.
data
).
toEqual
(
values
.
map
(
(
value
)
=>
value
[
1
]));
});
});
});
});
...
...
spec/frontend/monitoring/components/charts/time_series_spec.js
View file @
7c1fa749
...
@@ -23,14 +23,14 @@ import { timeSeriesGraphData } from '../../graph_data';
...
@@ -23,14 +23,14 @@ import { timeSeriesGraphData } from '../../graph_data';
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
// this throttle mock executes immediately
// this throttle mock executes immediately
jest
.
fn
(
func
=>
{
jest
.
fn
(
(
func
)
=>
{
// eslint-disable-next-line no-param-reassign
// eslint-disable-next-line no-param-reassign
func
.
cancel
=
jest
.
fn
();
func
.
cancel
=
jest
.
fn
();
return
func
;
return
func
;
}),
}),
);
);
jest
.
mock
(
'
~/lib/utils/icon_utils
'
,
()
=>
({
jest
.
mock
(
'
~/lib/utils/icon_utils
'
,
()
=>
({
getSvgIconPathContent
:
jest
.
fn
().
mockImplementation
(
icon
=>
Promise
.
resolve
(
`
${
icon
}
-content`
)),
getSvgIconPathContent
:
jest
.
fn
().
mockImplementation
(
(
icon
)
=>
Promise
.
resolve
(
`
${
icon
}
-content`
)),
}));
}));
describe
(
'
Time series component
'
,
()
=>
{
describe
(
'
Time series component
'
,
()
=>
{
...
@@ -122,7 +122,7 @@ describe('Time series component', () => {
...
@@ -122,7 +122,7 @@ describe('Time series component', () => {
},
},
],
],
}),
}),
off
:
jest
.
fn
(
eChartEvent
=>
{
off
:
jest
.
fn
(
(
eChartEvent
)
=>
{
delete
eChartMock
.
handlers
[
eChartEvent
];
delete
eChartMock
.
handlers
[
eChartEvent
];
}),
}),
on
:
jest
.
fn
((
eChartEvent
,
fn
)
=>
{
on
:
jest
.
fn
((
eChartEvent
,
fn
)
=>
{
...
@@ -193,7 +193,7 @@ describe('Time series component', () => {
...
@@ -193,7 +193,7 @@ describe('Time series component', () => {
it
(
'
does not throw error if data point is outside the zoom range
'
,
()
=>
{
it
(
'
does not throw error if data point is outside the zoom range
'
,
()
=>
{
const
seriesDataWithoutValue
=
{
const
seriesDataWithoutValue
=
{
...
mockLineSeriesData
(),
...
mockLineSeriesData
(),
seriesData
:
mockLineSeriesData
().
seriesData
.
map
(
data
=>
({
seriesData
:
mockLineSeriesData
().
seriesData
.
map
(
(
data
)
=>
({
...
data
,
...
data
,
value
:
undefined
,
value
:
undefined
,
})),
})),
...
@@ -270,7 +270,7 @@ describe('Time series component', () => {
...
@@ -270,7 +270,7 @@ describe('Time series component', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
.
vm
.
formatTooltipText
({
wrapper
.
vm
.
formatTooltipText
({
...
mockAnnotationsSeriesData
,
...
mockAnnotationsSeriesData
,
seriesData
:
mockAnnotationsSeriesData
.
seriesData
.
map
(
data
=>
({
seriesData
:
mockAnnotationsSeriesData
.
seriesData
.
map
(
(
data
)
=>
({
...
data
,
...
data
,
data
:
annotationsMetadata
,
data
:
annotationsMetadata
,
})),
})),
...
@@ -546,7 +546,7 @@ describe('Time series component', () => {
...
@@ -546,7 +546,7 @@ describe('Time series component', () => {
describe
(
'
xAxisLabel
'
,
()
=>
{
describe
(
'
xAxisLabel
'
,
()
=>
{
const
mockDate
=
Date
.
UTC
(
2020
,
4
,
26
,
20
);
// 8:00 PM in GMT
const
mockDate
=
Date
.
UTC
(
2020
,
4
,
26
,
20
);
// 8:00 PM in GMT
const
useXAxisFormatter
=
date
=>
{
const
useXAxisFormatter
=
(
date
)
=>
{
const
{
xAxis
}
=
getChartOptions
();
const
{
xAxis
}
=
getChartOptions
();
const
{
formatter
}
=
xAxis
.
axisLabel
;
const
{
formatter
}
=
xAxis
.
axisLabel
;
return
formatter
(
date
);
return
formatter
(
date
);
...
@@ -620,7 +620,7 @@ describe('Time series component', () => {
...
@@ -620,7 +620,7 @@ describe('Time series component', () => {
},
},
];
];
glChartComponents
.
forEach
(
dynamicComponent
=>
{
glChartComponents
.
forEach
(
(
dynamicComponent
)
=>
{
describe
(
`GitLab UI:
${
dynamicComponent
.
chartType
}
`
,
()
=>
{
describe
(
`GitLab UI:
${
dynamicComponent
.
chartType
}
`
,
()
=>
{
const
findChartComponent
=
()
=>
wrapper
.
find
(
dynamicComponent
.
component
);
const
findChartComponent
=
()
=>
wrapper
.
find
(
dynamicComponent
.
component
);
...
@@ -705,7 +705,7 @@ describe('Time series component', () => {
...
@@ -705,7 +705,7 @@ describe('Time series component', () => {
let
lineColors
;
let
lineColors
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
lineColors
=
wrapper
.
find
(
GlAreaChart
).
vm
.
series
.
map
(
item
=>
item
.
lineStyle
.
color
);
lineColors
=
wrapper
.
find
(
GlAreaChart
).
vm
.
series
.
map
(
(
item
)
=>
item
.
lineStyle
.
color
);
});
});
it
(
'
should contain different colors for contiguous time series
'
,
()
=>
{
it
(
'
should contain different colors for contiguous time series
'
,
()
=>
{
...
@@ -727,7 +727,7 @@ describe('Time series component', () => {
...
@@ -727,7 +727,7 @@ describe('Time series component', () => {
const
legendColors
=
wrapper
const
legendColors
=
wrapper
.
find
(
GlChartLegend
)
.
find
(
GlChartLegend
)
.
props
(
'
seriesInfo
'
)
.
props
(
'
seriesInfo
'
)
.
map
(
item
=>
item
.
color
);
.
map
(
(
item
)
=>
item
.
color
);
lineColors
.
forEach
((
color
,
index
)
=>
{
lineColors
.
forEach
((
color
,
index
)
=>
{
expect
(
color
).
toBe
(
legendColors
[
index
]);
expect
(
color
).
toBe
(
legendColors
[
index
]);
...
...
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