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
e3aca8c8
Commit
e3aca8c8
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 33 files - 53 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
3b1593f2
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
186 additions
and
221 deletions
+186
-221
.prettierignore
.prettierignore
+0
-35
spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/@gitlab/ui.js
+2
-2
spec/frontend/__mocks__/lodash/debounce.js
spec/frontend/__mocks__/lodash/debounce.js
+1
-1
spec/frontend/__mocks__/lodash/throttle.js
spec/frontend/__mocks__/lodash/throttle.js
+1
-1
spec/frontend/activities_spec.js
spec/frontend/activities_spec.js
+2
-2
spec/frontend/add_context_commits_modal/store/actions_spec.js
.../frontend/add_context_commits_modal/store/actions_spec.js
+12
-12
spec/frontend/admin/statistics_panel/components/app_spec.js
spec/frontend/admin/statistics_panel/components/app_spec.js
+1
-1
spec/frontend/admin/statistics_panel/store/actions_spec.js
spec/frontend/admin/statistics_panel/store/actions_spec.js
+5
-5
spec/frontend/alert_handler_spec.js
spec/frontend/alert_handler_spec.js
+1
-1
spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
...s_service_settings/components/alerts_service_form_spec.js
+1
-1
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
+2
-2
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
.../frontend/alerts_settings/alerts_settings_wrapper_spec.js
+1
-1
spec/frontend/analytics/instance_statistics/components/app_spec.js
...tend/analytics/instance_statistics/components/app_spec.js
+2
-2
spec/frontend/api_spec.js
spec/frontend/api_spec.js
+53
-53
spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js
...ication/two_factor_auth/components/recovery_codes_spec.js
+3
-3
spec/frontend/authentication/u2f/authenticate_spec.js
spec/frontend/authentication/u2f/authenticate_spec.js
+2
-2
spec/frontend/authentication/u2f/register_spec.js
spec/frontend/authentication/u2f/register_spec.js
+1
-1
spec/frontend/awards_handler_spec.js
spec/frontend/awards_handler_spec.js
+3
-3
spec/frontend/badges/components/badge_form_spec.js
spec/frontend/badges/components/badge_form_spec.js
+3
-3
spec/frontend/badges/components/badge_list_row_spec.js
spec/frontend/badges/components/badge_list_row_spec.js
+2
-2
spec/frontend/badges/components/badge_list_spec.js
spec/frontend/badges/components/badge_list_spec.js
+4
-4
spec/frontend/badges/components/badge_spec.js
spec/frontend/badges/components/badge_spec.js
+6
-6
spec/frontend/badges/store/actions_spec.js
spec/frontend/badges/store/actions_spec.js
+36
-36
spec/frontend/batch_comments/components/draft_note_spec.js
spec/frontend/batch_comments/components/draft_note_spec.js
+3
-3
spec/frontend/batch_comments/components/drafts_count_spec.js
spec/frontend/batch_comments/components/drafts_count_spec.js
+1
-1
spec/frontend/batch_comments/components/preview_item_spec.js
spec/frontend/batch_comments/components/preview_item_spec.js
+1
-1
spec/frontend/batch_comments/components/publish_button_spec.js
...frontend/batch_comments/components/publish_button_spec.js
+1
-1
spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
...ch_comments/stores/modules/batch_comments/actions_spec.js
+12
-12
spec/frontend/behaviors/autosize_spec.js
spec/frontend/behaviors/autosize_spec.js
+1
-1
spec/frontend/behaviors/copy_as_gfm_spec.js
spec/frontend/behaviors/copy_as_gfm_spec.js
+5
-5
spec/frontend/behaviors/load_startup_css_spec.js
spec/frontend/behaviors/load_startup_css_spec.js
+1
-1
spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
.../frontend/behaviors/markdown/paste_markdown_table_spec.js
+5
-5
spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/quick_submit_spec.js
+1
-1
spec/frontend/behaviors/secret_values_spec.js
spec/frontend/behaviors/secret_values_spec.js
+11
-11
No files found.
.prettierignore
View file @
e3aca8c8
...
@@ -1531,41 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js
...
@@ -1531,41 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_spec.js
## relaxed-goldwasser
spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/lodash/debounce.js
spec/frontend/__mocks__/lodash/throttle.js
spec/frontend/activities_spec.js
spec/frontend/add_context_commits_modal/store/actions_spec.js
spec/frontend/admin/statistics_panel/components/app_spec.js
spec/frontend/admin/statistics_panel/store/actions_spec.js
spec/frontend/alert_handler_spec.js
spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
spec/frontend/analytics/instance_statistics/components/app_spec.js
spec/frontend/api_spec.js
spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js
spec/frontend/authentication/u2f/authenticate_spec.js
spec/frontend/authentication/u2f/register_spec.js
spec/frontend/awards_handler_spec.js
spec/frontend/badges/components/badge_form_spec.js
spec/frontend/badges/components/badge_list_row_spec.js
spec/frontend/badges/components/badge_list_spec.js
spec/frontend/badges/components/badge_spec.js
spec/frontend/badges/store/actions_spec.js
spec/frontend/batch_comments/components/draft_note_spec.js
spec/frontend/batch_comments/components/drafts_count_spec.js
spec/frontend/batch_comments/components/preview_item_spec.js
spec/frontend/batch_comments/components/publish_button_spec.js
spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
spec/frontend/behaviors/autosize_spec.js
spec/frontend/behaviors/copy_as_gfm_spec.js
spec/frontend/behaviors/load_startup_css_spec.js
spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js
## eager-lamport
## eager-lamport
spec/frontend/behaviors/shortcuts/keybindings_spec.js
spec/frontend/behaviors/shortcuts/keybindings_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
...
...
spec/frontend/__mocks__/@gitlab/ui.js
View file @
e3aca8c8
...
@@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
...
@@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
required
:
false
,
required
:
false
,
default
:
()
=>
[],
default
:
()
=>
[],
},
},
...
Object
.
fromEntries
([
'
target
'
,
'
triggers
'
,
'
placement
'
].
map
(
prop
=>
[
prop
,
{}])),
...
Object
.
fromEntries
([
'
target
'
,
'
triggers
'
,
'
placement
'
].
map
(
(
prop
)
=>
[
prop
,
{}])),
},
},
render
(
h
)
{
render
(
h
)
{
return
h
(
return
h
(
...
@@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
...
@@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
class
:
'
gl-popover
'
,
class
:
'
gl-popover
'
,
...
this
.
$attrs
,
...
this
.
$attrs
,
},
},
Object
.
keys
(
this
.
$slots
).
map
(
s
=>
this
.
$slots
[
s
]),
Object
.
keys
(
this
.
$slots
).
map
(
(
s
)
=>
this
.
$slots
[
s
]),
);
);
},
},
}));
}));
spec/frontend/__mocks__/lodash/debounce.js
View file @
e3aca8c8
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378
// [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378
// Further reference: https://github.com/facebook/jest/issues/3465
// Further reference: https://github.com/facebook/jest/issues/3465
export
default
fn
=>
{
export
default
(
fn
)
=>
{
const
debouncedFn
=
jest
.
fn
().
mockImplementation
(
fn
);
const
debouncedFn
=
jest
.
fn
().
mockImplementation
(
fn
);
debouncedFn
.
cancel
=
jest
.
fn
();
debouncedFn
.
cancel
=
jest
.
fn
();
debouncedFn
.
flush
=
jest
.
fn
().
mockImplementation
(()
=>
{
debouncedFn
.
flush
=
jest
.
fn
().
mockImplementation
(()
=>
{
...
...
spec/frontend/__mocks__/lodash/throttle.js
View file @
e3aca8c8
// Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs.
// Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs.
// See `./debounce.js` for more details.
// See `./debounce.js` for more details.
export
default
fn
=>
fn
;
export
default
(
fn
)
=>
fn
;
spec/frontend/activities_spec.js
View file @
e3aca8c8
...
@@ -44,14 +44,14 @@ describe('Activities', () => {
...
@@ -44,14 +44,14 @@ describe('Activities', () => {
});
});
for
(
let
i
=
0
;
i
<
filters
.
length
;
i
+=
1
)
{
for
(
let
i
=
0
;
i
<
filters
.
length
;
i
+=
1
)
{
(
i
=>
{
(
(
i
)
=>
{
describe
(
`when selecting
${
getEventName
(
i
)}
`
,
()
=>
{
describe
(
`when selecting
${
getEventName
(
i
)}
`
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
$
(
getSelector
(
i
)).
click
();
$
(
getSelector
(
i
)).
click
();
});
});
for
(
let
x
=
0
;
x
<
filters
.
length
;
x
+=
1
)
{
for
(
let
x
=
0
;
x
<
filters
.
length
;
x
+=
1
)
{
(
x
=>
{
(
(
x
)
=>
{
const
shouldHighlight
=
i
===
x
;
const
shouldHighlight
=
i
===
x
;
const
testName
=
shouldHighlight
?
'
should highlight
'
:
'
should not highlight
'
;
const
testName
=
shouldHighlight
?
'
should highlight
'
:
'
should not highlight
'
;
...
...
spec/frontend/add_context_commits_modal/store/actions_spec.js
View file @
e3aca8c8
...
@@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setBaseConfig
'
,
()
=>
{
describe
(
'
setBaseConfig
'
,
()
=>
{
it
(
'
commits SET_BASE_CONFIG
'
,
done
=>
{
it
(
'
commits SET_BASE_CONFIG
'
,
(
done
)
=>
{
const
options
=
{
contextCommitsPath
,
mergeRequestIid
,
projectId
};
const
options
=
{
contextCommitsPath
,
mergeRequestIid
,
projectId
};
testAction
(
testAction
(
setBaseConfig
,
setBaseConfig
,
...
@@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setTabIndex
'
,
()
=>
{
describe
(
'
setTabIndex
'
,
()
=>
{
it
(
'
commits SET_TABINDEX
'
,
done
=>
{
it
(
'
commits SET_TABINDEX
'
,
(
done
)
=>
{
testAction
(
testAction
(
setTabIndex
,
setTabIndex
,
{
tabIndex
:
1
},
{
tabIndex
:
1
},
...
@@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setCommits
'
,
()
=>
{
describe
(
'
setCommits
'
,
()
=>
{
it
(
'
commits SET_COMMITS
'
,
done
=>
{
it
(
'
commits SET_COMMITS
'
,
(
done
)
=>
{
testAction
(
testAction
(
setCommits
,
setCommits
,
{
commits
:
[],
silentAddition
:
false
},
{
commits
:
[],
silentAddition
:
false
},
...
@@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => {
);
);
});
});
it
(
'
commits SET_COMMITS_SILENT
'
,
done
=>
{
it
(
'
commits SET_COMMITS_SILENT
'
,
(
done
)
=>
{
testAction
(
testAction
(
setCommits
,
setCommits
,
{
commits
:
[],
silentAddition
:
true
},
{
commits
:
[],
silentAddition
:
true
},
...
@@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
createContextCommits
'
,
()
=>
{
describe
(
'
createContextCommits
'
,
()
=>
{
it
(
'
calls API to create context commits
'
,
done
=>
{
it
(
'
calls API to create context commits
'
,
(
done
)
=>
{
mock
.
onPost
(
contextCommitEndpoint
).
reply
(
200
,
{});
mock
.
onPost
(
contextCommitEndpoint
).
reply
(
200
,
{});
testAction
(
createContextCommits
,
{
commits
:
[]
},
{},
[],
[],
done
);
testAction
(
createContextCommits
,
{
commits
:
[]
},
{},
[],
[],
done
);
...
@@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => {
)
)
.
reply
(
200
,
[
dummyCommit
]);
.
reply
(
200
,
[
dummyCommit
]);
});
});
it
(
'
commits FETCH_CONTEXT_COMMITS
'
,
done
=>
{
it
(
'
commits FETCH_CONTEXT_COMMITS
'
,
(
done
)
=>
{
const
contextCommit
=
{
...
dummyCommit
,
isSelected
:
true
};
const
contextCommit
=
{
...
dummyCommit
,
isSelected
:
true
};
testAction
(
testAction
(
fetchContextCommits
,
fetchContextCommits
,
...
@@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setContextCommits
'
,
()
=>
{
describe
(
'
setContextCommits
'
,
()
=>
{
it
(
'
commits SET_CONTEXT_COMMITS
'
,
done
=>
{
it
(
'
commits SET_CONTEXT_COMMITS
'
,
(
done
)
=>
{
testAction
(
testAction
(
setContextCommits
,
setContextCommits
,
{
data
:
[]
},
{
data
:
[]
},
...
@@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => {
.
onDelete
(
'
/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits
'
)
.
onDelete
(
'
/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits
'
)
.
reply
(
204
);
.
reply
(
204
);
});
});
it
(
'
calls API to remove context commits
'
,
done
=>
{
it
(
'
calls API to remove context commits
'
,
(
done
)
=>
{
testAction
(
testAction
(
removeContextCommits
,
removeContextCommits
,
{
forceReload
:
false
},
{
forceReload
:
false
},
...
@@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setSelectedCommits
'
,
()
=>
{
describe
(
'
setSelectedCommits
'
,
()
=>
{
it
(
'
commits SET_SELECTED_COMMITS
'
,
done
=>
{
it
(
'
commits SET_SELECTED_COMMITS
'
,
(
done
)
=>
{
testAction
(
testAction
(
setSelectedCommits
,
setSelectedCommits
,
[
dummyCommit
],
[
dummyCommit
],
...
@@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setSearchText
'
,
()
=>
{
describe
(
'
setSearchText
'
,
()
=>
{
it
(
'
commits SET_SEARCH_TEXT
'
,
done
=>
{
it
(
'
commits SET_SEARCH_TEXT
'
,
(
done
)
=>
{
const
searchText
=
'
Dummy Text
'
;
const
searchText
=
'
Dummy Text
'
;
testAction
(
testAction
(
setSearchText
,
setSearchText
,
...
@@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
setToRemoveCommits
'
,
()
=>
{
describe
(
'
setToRemoveCommits
'
,
()
=>
{
it
(
'
commits SET_TO_REMOVE_COMMITS
'
,
done
=>
{
it
(
'
commits SET_TO_REMOVE_COMMITS
'
,
(
done
)
=>
{
const
commitId
=
'
abcde
'
;
const
commitId
=
'
abcde
'
;
testAction
(
testAction
(
...
@@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => {
...
@@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
});
describe
(
'
resetModalState
'
,
()
=>
{
describe
(
'
resetModalState
'
,
()
=>
{
it
(
'
commits RESET_MODAL_STATE
'
,
done
=>
{
it
(
'
commits RESET_MODAL_STATE
'
,
(
done
)
=>
{
const
commitId
=
'
abcde
'
;
const
commitId
=
'
abcde
'
;
testAction
(
testAction
(
...
...
spec/frontend/admin/statistics_panel/components/app_spec.js
View file @
e3aca8c8
...
@@ -34,7 +34,7 @@ describe('Admin statistics app', () => {
...
@@ -34,7 +34,7 @@ describe('Admin statistics app', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
const
findStats
=
idx
=>
wrapper
.
findAll
(
'
.js-stats
'
).
at
(
idx
);
const
findStats
=
(
idx
)
=>
wrapper
.
findAll
(
'
.js-stats
'
).
at
(
idx
);
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
describe
(
'
when app is loading
'
,
()
=>
{
describe
(
'
when app is loading
'
,
()
=>
{
...
...
spec/frontend/admin/statistics_panel/store/actions_spec.js
View file @
e3aca8c8
...
@@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => {
...
@@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => {
mock
.
onGet
(
/api
\/(
.*
)\/
application
\/
statistics/
).
replyOnce
(
200
,
mockStatistics
);
mock
.
onGet
(
/api
\/(
.*
)\/
application
\/
statistics/
).
replyOnce
(
200
,
mockStatistics
);
});
});
it
(
'
dispatches success with received data
'
,
done
=>
it
(
'
dispatches success with received data
'
,
(
done
)
=>
testAction
(
testAction
(
actions
.
fetchStatistics
,
actions
.
fetchStatistics
,
null
,
null
,
...
@@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => {
...
@@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => {
mock
.
onGet
(
/api
\/(
.*
)\/
application
\/
statistics/
).
replyOnce
(
500
);
mock
.
onGet
(
/api
\/(
.*
)\/
application
\/
statistics/
).
replyOnce
(
500
);
});
});
it
(
'
dispatches error
'
,
done
=>
it
(
'
dispatches error
'
,
(
done
)
=>
testAction
(
testAction
(
actions
.
fetchStatistics
,
actions
.
fetchStatistics
,
null
,
null
,
...
@@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => {
...
@@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => {
});
});
describe
(
'
requestStatistic
'
,
()
=>
{
describe
(
'
requestStatistic
'
,
()
=>
{
it
(
'
should commit the request mutation
'
,
done
=>
it
(
'
should commit the request mutation
'
,
(
done
)
=>
testAction
(
testAction
(
actions
.
requestStatistics
,
actions
.
requestStatistics
,
null
,
null
,
...
@@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => {
...
@@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => {
});
});
describe
(
'
receiveStatisticsSuccess
'
,
()
=>
{
describe
(
'
receiveStatisticsSuccess
'
,
()
=>
{
it
(
'
should commit received data
'
,
done
=>
it
(
'
should commit received data
'
,
(
done
)
=>
testAction
(
testAction
(
actions
.
receiveStatisticsSuccess
,
actions
.
receiveStatisticsSuccess
,
mockStatistics
,
mockStatistics
,
...
@@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => {
...
@@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => {
});
});
describe
(
'
receiveStatisticsError
'
,
()
=>
{
describe
(
'
receiveStatisticsError
'
,
()
=>
{
it
(
'
should commit error
'
,
done
=>
{
it
(
'
should commit error
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveStatisticsError
,
actions
.
receiveStatisticsError
,
500
,
500
,
...
...
spec/frontend/alert_handler_spec.js
View file @
e3aca8c8
...
@@ -7,7 +7,7 @@ describe('Alert Handler', () => {
...
@@ -7,7 +7,7 @@ describe('Alert Handler', () => {
const
DISMISS_CLASS
=
'
gl-alert-dismiss
'
;
const
DISMISS_CLASS
=
'
gl-alert-dismiss
'
;
const
DISMISS_LABEL
=
'
Dismiss
'
;
const
DISMISS_LABEL
=
'
Dismiss
'
;
const
generateHtml
=
parentClass
=>
const
generateHtml
=
(
parentClass
)
=>
`<div class="
${
parentClass
}
">
`<div class="
${
parentClass
}
">
<button aria-label="
${
DISMISS_LABEL
}
">Dismiss</button>
<button aria-label="
${
DISMISS_LABEL
}
">Dismiss</button>
</div>`
;
</div>`
;
...
...
spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
View file @
e3aca8c8
...
@@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => {
...
@@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => {
const
findUrl
=
()
=>
wrapper
.
find
(
'
#url
'
);
const
findUrl
=
()
=>
wrapper
.
find
(
'
#url
'
);
const
findAuthorizationKey
=
()
=>
wrapper
.
find
(
'
#authorization-key
'
);
const
findAuthorizationKey
=
()
=>
wrapper
.
find
(
'
#authorization-key
'
);
const
findDescription
=
()
=>
wrapper
.
find
(
'
[data-testid="description"
'
);
const
findDescription
=
()
=>
wrapper
.
find
(
'
[data-testid="description"
'
);
const
findActiveStatusIcon
=
val
=>
const
findActiveStatusIcon
=
(
val
)
=>
document
.
querySelector
(
`.js-service-active-status[data-value=
${
val
.
toString
()}
]`
);
document
.
querySelector
(
`.js-service-active-status[data-value=
${
val
.
toString
()}
]`
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
...
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
View file @
e3aca8c8
...
@@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => {
...
@@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => {
const
dropdownItems
=
dropdown
.
findAll
(
GlDropdownItem
);
const
dropdownItems
=
dropdown
.
findAll
(
GlDropdownItem
);
const
{
nodes
}
=
parsedMapping
.
samplePayload
.
payloadAlerFields
;
const
{
nodes
}
=
parsedMapping
.
samplePayload
.
payloadAlerFields
;
const
numberOfMappingOptions
=
nodes
.
filter
(({
type
})
=>
const
numberOfMappingOptions
=
nodes
.
filter
(({
type
})
=>
type
.
some
(
t
=>
compatibleTypes
.
includes
(
t
)),
type
.
some
(
(
t
)
=>
compatibleTypes
.
includes
(
t
)),
);
);
expect
(
dropdown
.
exists
()).
toBe
(
true
);
expect
(
dropdown
.
exists
()).
toBe
(
true
);
...
@@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => {
...
@@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => {
const
dropdownItems
=
dropdown
.
findAll
(
GlDropdownItem
);
const
dropdownItems
=
dropdown
.
findAll
(
GlDropdownItem
);
const
{
nodes
}
=
parsedMapping
.
samplePayload
.
payloadAlerFields
;
const
{
nodes
}
=
parsedMapping
.
samplePayload
.
payloadAlerFields
;
const
numberOfMappingOptions
=
nodes
.
filter
(({
type
})
=>
const
numberOfMappingOptions
=
nodes
.
filter
(({
type
})
=>
type
.
some
(
t
=>
compatibleTypes
.
includes
(
t
)),
type
.
some
(
(
t
)
=>
compatibleTypes
.
includes
(
t
)),
);
);
expect
(
searchBox
.
exists
()).
toBe
(
Boolean
(
numberOfFallbacks
));
expect
(
searchBox
.
exists
()).
toBe
(
Boolean
(
numberOfFallbacks
));
...
...
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
View file @
e3aca8c8
...
@@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => {
...
@@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => {
// TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
// TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
describe
(
'
Opsgenie integration
'
,
()
=>
{
describe
(
'
Opsgenie integration
'
,
()
=>
{
it
.
each
([
true
,
false
])(
'
it shows/hides the alert when opsgenie is %s
'
,
active
=>
{
it
.
each
([
true
,
false
])(
'
it shows/hides the alert when opsgenie is %s
'
,
(
active
)
=>
{
createComponent
({
createComponent
({
data
:
{
integrations
:
{
list
:
mockIntegrations
},
currentIntegration
:
mockIntegrations
[
0
]
},
data
:
{
integrations
:
{
list
:
mockIntegrations
},
currentIntegration
:
mockIntegrations
[
0
]
},
provide
:
{
opsgenie
:
{
active
}
},
provide
:
{
opsgenie
:
{
active
}
},
...
...
spec/frontend/analytics/instance_statistics/components/app_spec.js
View file @
e3aca8c8
...
@@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => {
...
@@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => {
expect
(
wrapper
.
find
(
InstanceCounts
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
InstanceCounts
).
exists
()).
toBe
(
true
);
});
});
[
'
Pipelines
'
,
'
Issues & Merge Requests
'
].
forEach
(
instance
=>
{
[
'
Pipelines
'
,
'
Issues & Merge Requests
'
].
forEach
(
(
instance
)
=>
{
it
(
`displays the
${
instance
}
chart`
,
()
=>
{
it
(
`displays the
${
instance
}
chart`
,
()
=>
{
const
chartTitles
=
wrapper
const
chartTitles
=
wrapper
.
findAll
(
InstanceStatisticsCountChart
)
.
findAll
(
InstanceStatisticsCountChart
)
.
wrappers
.
map
(
chartComponent
=>
chartComponent
.
props
(
'
chartTitle
'
));
.
wrappers
.
map
(
(
chartComponent
)
=>
chartComponent
.
props
(
'
chartTitle
'
));
expect
(
chartTitles
).
toContain
(
instance
);
expect
(
chartTitles
).
toContain
(
instance
);
});
});
...
...
spec/frontend/api_spec.js
View file @
e3aca8c8
...
@@ -34,7 +34,7 @@ describe('Api', () => {
...
@@ -34,7 +34,7 @@ describe('Api', () => {
expect
(
builtUrl
).
toEqual
(
expectedOutput
);
expect
(
builtUrl
).
toEqual
(
expectedOutput
);
});
});
[
null
,
''
,
'
/
'
].
forEach
(
root
=>
{
[
null
,
''
,
'
/
'
].
forEach
(
(
root
)
=>
{
it
(
`works when relative_url_root is
${
root
}
`
,
()
=>
{
it
(
`works when relative_url_root is
${
root
}
`
,
()
=>
{
window
.
gon
.
relative_url_root
=
root
;
window
.
gon
.
relative_url_root
=
root
;
const
input
=
'
/api/:version/foo/bar
'
;
const
input
=
'
/api/:version/foo/bar
'
;
...
@@ -137,14 +137,14 @@ describe('Api', () => {
...
@@ -137,14 +137,14 @@ describe('Api', () => {
});
});
describe
(
'
group
'
,
()
=>
{
describe
(
'
group
'
,
()
=>
{
it
(
'
fetches a group
'
,
done
=>
{
it
(
'
fetches a group
'
,
(
done
)
=>
{
const
groupId
=
'
123456
'
;
const
groupId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
name
:
'
test
'
,
name
:
'
test
'
,
});
});
Api
.
group
(
groupId
,
response
=>
{
Api
.
group
(
groupId
,
(
response
)
=>
{
expect
(
response
.
name
).
toBe
(
'
test
'
);
expect
(
response
.
name
).
toBe
(
'
test
'
);
done
();
done
();
});
});
...
@@ -152,7 +152,7 @@ describe('Api', () => {
...
@@ -152,7 +152,7 @@ describe('Api', () => {
});
});
describe
(
'
groupMembers
'
,
()
=>
{
describe
(
'
groupMembers
'
,
()
=>
{
it
(
'
fetches group members
'
,
done
=>
{
it
(
'
fetches group members
'
,
(
done
)
=>
{
const
groupId
=
'
54321
'
;
const
groupId
=
'
54321
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/members`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/members`
;
const
expectedData
=
[{
id
:
7
}];
const
expectedData
=
[{
id
:
7
}];
...
@@ -168,7 +168,7 @@ describe('Api', () => {
...
@@ -168,7 +168,7 @@ describe('Api', () => {
});
});
describe
(
'
groupMilestones
'
,
()
=>
{
describe
(
'
groupMilestones
'
,
()
=>
{
it
(
'
fetches group milestones
'
,
done
=>
{
it
(
'
fetches group milestones
'
,
(
done
)
=>
{
const
groupId
=
'
16
'
;
const
groupId
=
'
16
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/milestones`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/milestones`
;
const
expectedData
=
[
const
expectedData
=
[
...
@@ -198,7 +198,7 @@ describe('Api', () => {
...
@@ -198,7 +198,7 @@ describe('Api', () => {
});
});
describe
(
'
groups
'
,
()
=>
{
describe
(
'
groups
'
,
()
=>
{
it
(
'
fetches groups
'
,
done
=>
{
it
(
'
fetches groups
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups.json`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups.json`
;
...
@@ -208,7 +208,7 @@ describe('Api', () => {
...
@@ -208,7 +208,7 @@ describe('Api', () => {
},
},
]);
]);
Api
.
groups
(
query
,
options
,
response
=>
{
Api
.
groups
(
query
,
options
,
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
...
@@ -217,7 +217,7 @@ describe('Api', () => {
...
@@ -217,7 +217,7 @@ describe('Api', () => {
});
});
describe
(
'
namespaces
'
,
()
=>
{
describe
(
'
namespaces
'
,
()
=>
{
it
(
'
fetches namespaces
'
,
done
=>
{
it
(
'
fetches namespaces
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/namespaces.json`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/namespaces.json`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
[
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
[
...
@@ -226,7 +226,7 @@ describe('Api', () => {
...
@@ -226,7 +226,7 @@ describe('Api', () => {
},
},
]);
]);
Api
.
namespaces
(
query
,
response
=>
{
Api
.
namespaces
(
query
,
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
...
@@ -235,7 +235,7 @@ describe('Api', () => {
...
@@ -235,7 +235,7 @@ describe('Api', () => {
});
});
describe
(
'
projects
'
,
()
=>
{
describe
(
'
projects
'
,
()
=>
{
it
(
'
fetches projects with membership when logged in
'
,
done
=>
{
it
(
'
fetches projects with membership when logged in
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects.json`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects.json`
;
...
@@ -246,14 +246,14 @@ describe('Api', () => {
...
@@ -246,14 +246,14 @@ describe('Api', () => {
},
},
]);
]);
Api
.
projects
(
query
,
options
,
response
=>
{
Api
.
projects
(
query
,
options
,
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
});
});
});
});
it
(
'
fetches projects without membership when not logged in
'
,
done
=>
{
it
(
'
fetches projects without membership when not logged in
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects.json`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects.json`
;
...
@@ -263,7 +263,7 @@ describe('Api', () => {
...
@@ -263,7 +263,7 @@ describe('Api', () => {
},
},
]);
]);
Api
.
projects
(
query
,
options
,
response
=>
{
Api
.
projects
(
query
,
options
,
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
...
@@ -272,7 +272,7 @@ describe('Api', () => {
...
@@ -272,7 +272,7 @@ describe('Api', () => {
});
});
describe
(
'
updateProject
'
,
()
=>
{
describe
(
'
updateProject
'
,
()
=>
{
it
(
'
update a project with the given payload
'
,
done
=>
{
it
(
'
update a project with the given payload
'
,
(
done
)
=>
{
const
projectPath
=
'
foo
'
;
const
projectPath
=
'
foo
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
`
;
mock
.
onPut
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
foo
:
'
bar
'
});
mock
.
onPut
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
foo
:
'
bar
'
});
...
@@ -287,7 +287,7 @@ describe('Api', () => {
...
@@ -287,7 +287,7 @@ describe('Api', () => {
});
});
describe
(
'
projectUsers
'
,
()
=>
{
describe
(
'
projectUsers
'
,
()
=>
{
it
(
'
fetches all users of a particular project
'
,
done
=>
{
it
(
'
fetches all users of a particular project
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
projectPath
=
'
gitlab-org%2Fgitlab-ce
'
;
const
projectPath
=
'
gitlab-org%2Fgitlab-ce
'
;
...
@@ -299,7 +299,7 @@ describe('Api', () => {
...
@@ -299,7 +299,7 @@ describe('Api', () => {
]);
]);
Api
.
projectUsers
(
'
gitlab-org/gitlab-ce
'
,
query
,
options
)
Api
.
projectUsers
(
'
gitlab-org/gitlab-ce
'
,
query
,
options
)
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
})
})
...
@@ -312,7 +312,7 @@ describe('Api', () => {
...
@@ -312,7 +312,7 @@ describe('Api', () => {
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests`
;
it
(
'
fetches all merge requests for a project
'
,
done
=>
{
it
(
'
fetches all merge requests for a project
'
,
(
done
)
=>
{
const
mockData
=
[{
source_branch
:
'
foo
'
},
{
source_branch
:
'
bar
'
}];
const
mockData
=
[{
source_branch
:
'
foo
'
},
{
source_branch
:
'
bar
'
}];
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
mockData
);
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
mockData
);
Api
.
projectMergeRequests
(
projectPath
)
Api
.
projectMergeRequests
(
projectPath
)
...
@@ -325,7 +325,7 @@ describe('Api', () => {
...
@@ -325,7 +325,7 @@ describe('Api', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
fetches merge requests filtered with passed params
'
,
done
=>
{
it
(
'
fetches merge requests filtered with passed params
'
,
(
done
)
=>
{
const
params
=
{
const
params
=
{
source_branch
:
'
bar
'
,
source_branch
:
'
bar
'
,
};
};
...
@@ -343,7 +343,7 @@ describe('Api', () => {
...
@@ -343,7 +343,7 @@ describe('Api', () => {
});
});
describe
(
'
projectMergeRequest
'
,
()
=>
{
describe
(
'
projectMergeRequest
'
,
()
=>
{
it
(
'
fetches a merge request
'
,
done
=>
{
it
(
'
fetches a merge request
'
,
(
done
)
=>
{
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
mergeRequestId
=
'
123456
'
;
const
mergeRequestId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
`
;
...
@@ -361,7 +361,7 @@ describe('Api', () => {
...
@@ -361,7 +361,7 @@ describe('Api', () => {
});
});
describe
(
'
projectMergeRequestChanges
'
,
()
=>
{
describe
(
'
projectMergeRequestChanges
'
,
()
=>
{
it
(
'
fetches the changes of a merge request
'
,
done
=>
{
it
(
'
fetches the changes of a merge request
'
,
(
done
)
=>
{
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
mergeRequestId
=
'
123456
'
;
const
mergeRequestId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
/changes`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
/changes`
;
...
@@ -379,7 +379,7 @@ describe('Api', () => {
...
@@ -379,7 +379,7 @@ describe('Api', () => {
});
});
describe
(
'
projectMergeRequestVersions
'
,
()
=>
{
describe
(
'
projectMergeRequestVersions
'
,
()
=>
{
it
(
'
fetches the versions of a merge request
'
,
done
=>
{
it
(
'
fetches the versions of a merge request
'
,
(
done
)
=>
{
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
mergeRequestId
=
'
123456
'
;
const
mergeRequestId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
/versions`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
/versions`
;
...
@@ -400,7 +400,7 @@ describe('Api', () => {
...
@@ -400,7 +400,7 @@ describe('Api', () => {
});
});
describe
(
'
projectRunners
'
,
()
=>
{
describe
(
'
projectRunners
'
,
()
=>
{
it
(
'
fetches the runners of a project
'
,
done
=>
{
it
(
'
fetches the runners of a project
'
,
(
done
)
=>
{
const
projectPath
=
7
;
const
projectPath
=
7
;
const
params
=
{
scope
:
'
active
'
};
const
params
=
{
scope
:
'
active
'
};
const
mockData
=
[{
id
:
4
}];
const
mockData
=
[{
id
:
4
}];
...
@@ -417,7 +417,7 @@ describe('Api', () => {
...
@@ -417,7 +417,7 @@ describe('Api', () => {
});
});
describe
(
'
projectMilestones
'
,
()
=>
{
describe
(
'
projectMilestones
'
,
()
=>
{
it
(
'
fetches project milestones
'
,
done
=>
{
it
(
'
fetches project milestones
'
,
(
done
)
=>
{
const
projectId
=
1
;
const
projectId
=
1
;
const
options
=
{
state
:
'
active
'
};
const
options
=
{
state
:
'
active
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/1/milestones`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/1/milestones`
;
...
@@ -459,7 +459,7 @@ describe('Api', () => {
...
@@ -459,7 +459,7 @@ describe('Api', () => {
});
});
describe
(
'
newLabel
'
,
()
=>
{
describe
(
'
newLabel
'
,
()
=>
{
it
(
'
creates a new label
'
,
done
=>
{
it
(
'
creates a new label
'
,
(
done
)
=>
{
const
namespace
=
'
some namespace
'
;
const
namespace
=
'
some namespace
'
;
const
project
=
'
some project
'
;
const
project
=
'
some project
'
;
const
labelData
=
{
some
:
'
data
'
};
const
labelData
=
{
some
:
'
data
'
};
...
@@ -467,7 +467,7 @@ describe('Api', () => {
...
@@ -467,7 +467,7 @@ describe('Api', () => {
const
expectedData
=
{
const
expectedData
=
{
label
:
labelData
,
label
:
labelData
,
};
};
mock
.
onPost
(
expectedUrl
).
reply
(
config
=>
{
mock
.
onPost
(
expectedUrl
).
reply
(
(
config
)
=>
{
expect
(
config
.
data
).
toBe
(
JSON
.
stringify
(
expectedData
));
expect
(
config
.
data
).
toBe
(
JSON
.
stringify
(
expectedData
));
return
[
return
[
...
@@ -478,20 +478,20 @@ describe('Api', () => {
...
@@ -478,20 +478,20 @@ describe('Api', () => {
];
];
});
});
Api
.
newLabel
(
namespace
,
project
,
labelData
,
response
=>
{
Api
.
newLabel
(
namespace
,
project
,
labelData
,
(
response
)
=>
{
expect
(
response
.
name
).
toBe
(
'
test
'
);
expect
(
response
.
name
).
toBe
(
'
test
'
);
done
();
done
();
});
});
});
});
it
(
'
creates a group label
'
,
done
=>
{
it
(
'
creates a group label
'
,
(
done
)
=>
{
const
namespace
=
'
group/subgroup
'
;
const
namespace
=
'
group/subgroup
'
;
const
labelData
=
{
some
:
'
data
'
};
const
labelData
=
{
some
:
'
data
'
};
const
expectedUrl
=
Api
.
buildUrl
(
Api
.
groupLabelsPath
).
replace
(
'
:namespace_path
'
,
namespace
);
const
expectedUrl
=
Api
.
buildUrl
(
Api
.
groupLabelsPath
).
replace
(
'
:namespace_path
'
,
namespace
);
const
expectedData
=
{
const
expectedData
=
{
label
:
labelData
,
label
:
labelData
,
};
};
mock
.
onPost
(
expectedUrl
).
reply
(
config
=>
{
mock
.
onPost
(
expectedUrl
).
reply
(
(
config
)
=>
{
expect
(
config
.
data
).
toBe
(
JSON
.
stringify
(
expectedData
));
expect
(
config
.
data
).
toBe
(
JSON
.
stringify
(
expectedData
));
return
[
return
[
...
@@ -502,7 +502,7 @@ describe('Api', () => {
...
@@ -502,7 +502,7 @@ describe('Api', () => {
];
];
});
});
Api
.
newLabel
(
namespace
,
undefined
,
labelData
,
response
=>
{
Api
.
newLabel
(
namespace
,
undefined
,
labelData
,
(
response
)
=>
{
expect
(
response
.
name
).
toBe
(
'
test
'
);
expect
(
response
.
name
).
toBe
(
'
test
'
);
done
();
done
();
});
});
...
@@ -510,7 +510,7 @@ describe('Api', () => {
...
@@ -510,7 +510,7 @@ describe('Api', () => {
});
});
describe
(
'
groupProjects
'
,
()
=>
{
describe
(
'
groupProjects
'
,
()
=>
{
it
(
'
fetches group projects
'
,
done
=>
{
it
(
'
fetches group projects
'
,
(
done
)
=>
{
const
groupId
=
'
123456
'
;
const
groupId
=
'
123456
'
;
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/projects.json`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/groups/
${
groupId
}
/projects.json`
;
...
@@ -520,7 +520,7 @@ describe('Api', () => {
...
@@ -520,7 +520,7 @@ describe('Api', () => {
},
},
]);
]);
Api
.
groupProjects
(
groupId
,
query
,
{},
response
=>
{
Api
.
groupProjects
(
groupId
,
query
,
{},
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
...
@@ -561,7 +561,7 @@ describe('Api', () => {
...
@@ -561,7 +561,7 @@ describe('Api', () => {
templateKey
,
templateKey
,
)}
`
;
)}
`
;
it
(
'
fetches an issue template
'
,
done
=>
{
it
(
'
fetches an issue template
'
,
(
done
)
=>
{
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
'
test
'
);
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
'
test
'
);
Api
.
issueTemplate
(
namespace
,
project
,
templateKey
,
templateType
,
(
error
,
response
)
=>
{
Api
.
issueTemplate
(
namespace
,
project
,
templateKey
,
templateType
,
(
error
,
response
)
=>
{
...
@@ -587,7 +587,7 @@ describe('Api', () => {
...
@@ -587,7 +587,7 @@ describe('Api', () => {
const
templateType
=
'
template type
'
;
const
templateType
=
'
template type
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/
${
namespace
}
/
${
project
}
/templates/
${
templateType
}
`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/
${
namespace
}
/
${
project
}
/templates/
${
templateType
}
`
;
it
(
'
fetches all templates by type
'
,
done
=>
{
it
(
'
fetches all templates by type
'
,
(
done
)
=>
{
const
expectedData
=
[
const
expectedData
=
[
{
key
:
'
Template1
'
,
name
:
'
Template 1
'
,
content
:
'
This is template 1!
'
},
{
key
:
'
Template1
'
,
name
:
'
Template 1
'
,
content
:
'
This is template 1!
'
},
];
];
...
@@ -615,12 +615,12 @@ describe('Api', () => {
...
@@ -615,12 +615,12 @@ describe('Api', () => {
});
});
describe
(
'
projectTemplates
'
,
()
=>
{
describe
(
'
projectTemplates
'
,
()
=>
{
it
(
'
fetches a list of templates
'
,
done
=>
{
it
(
'
fetches a list of templates
'
,
(
done
)
=>
{
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/gitlab-org%2Fgitlab-ce/templates/licenses`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/gitlab-org%2Fgitlab-ce/templates/licenses`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
'
test
'
);
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
'
test
'
);
Api
.
projectTemplates
(
'
gitlab-org/gitlab-ce
'
,
'
licenses
'
,
{},
response
=>
{
Api
.
projectTemplates
(
'
gitlab-org/gitlab-ce
'
,
'
licenses
'
,
{},
(
response
)
=>
{
expect
(
response
).
toBe
(
'
test
'
);
expect
(
response
).
toBe
(
'
test
'
);
done
();
done
();
});
});
...
@@ -628,13 +628,13 @@ describe('Api', () => {
...
@@ -628,13 +628,13 @@ describe('Api', () => {
});
});
describe
(
'
projectTemplate
'
,
()
=>
{
describe
(
'
projectTemplate
'
,
()
=>
{
it
(
'
fetches a single template
'
,
done
=>
{
it
(
'
fetches a single template
'
,
(
done
)
=>
{
const
data
=
{
unused
:
'
option
'
};
const
data
=
{
unused
:
'
option
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/gitlab-org%2Fgitlab-ce/templates/licenses/test%20license`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/gitlab-org%2Fgitlab-ce/templates/licenses/test%20license`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
'
test
'
);
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
'
test
'
);
Api
.
projectTemplate
(
'
gitlab-org/gitlab-ce
'
,
'
licenses
'
,
'
test license
'
,
data
,
response
=>
{
Api
.
projectTemplate
(
'
gitlab-org/gitlab-ce
'
,
'
licenses
'
,
'
test license
'
,
data
,
(
response
)
=>
{
expect
(
response
).
toBe
(
'
test
'
);
expect
(
response
).
toBe
(
'
test
'
);
done
();
done
();
});
});
...
@@ -642,7 +642,7 @@ describe('Api', () => {
...
@@ -642,7 +642,7 @@ describe('Api', () => {
});
});
describe
(
'
users
'
,
()
=>
{
describe
(
'
users
'
,
()
=>
{
it
(
'
fetches users
'
,
done
=>
{
it
(
'
fetches users
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/users.json`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/users.json`
;
...
@@ -663,7 +663,7 @@ describe('Api', () => {
...
@@ -663,7 +663,7 @@ describe('Api', () => {
});
});
describe
(
'
user
'
,
()
=>
{
describe
(
'
user
'
,
()
=>
{
it
(
'
fetches single user
'
,
done
=>
{
it
(
'
fetches single user
'
,
(
done
)
=>
{
const
userId
=
'
123456
'
;
const
userId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/users/
${
userId
}
`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/users/
${
userId
}
`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
...
@@ -680,7 +680,7 @@ describe('Api', () => {
...
@@ -680,7 +680,7 @@ describe('Api', () => {
});
});
describe
(
'
user counts
'
,
()
=>
{
describe
(
'
user counts
'
,
()
=>
{
it
(
'
fetches single user counts
'
,
done
=>
{
it
(
'
fetches single user counts
'
,
(
done
)
=>
{
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/user_counts`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/user_counts`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
merge_requests
:
4
,
merge_requests
:
4
,
...
@@ -696,7 +696,7 @@ describe('Api', () => {
...
@@ -696,7 +696,7 @@ describe('Api', () => {
});
});
describe
(
'
user status
'
,
()
=>
{
describe
(
'
user status
'
,
()
=>
{
it
(
'
fetches single user status
'
,
done
=>
{
it
(
'
fetches single user status
'
,
(
done
)
=>
{
const
userId
=
'
123456
'
;
const
userId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/users/
${
userId
}
/status`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/users/
${
userId
}
/status`
;
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
mock
.
onGet
(
expectedUrl
).
reply
(
httpStatus
.
OK
,
{
...
@@ -713,7 +713,7 @@ describe('Api', () => {
...
@@ -713,7 +713,7 @@ describe('Api', () => {
});
});
describe
(
'
user projects
'
,
()
=>
{
describe
(
'
user projects
'
,
()
=>
{
it
(
'
fetches all projects that belong to a particular user
'
,
done
=>
{
it
(
'
fetches all projects that belong to a particular user
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
userId
=
'
123456
'
;
const
userId
=
'
123456
'
;
...
@@ -724,7 +724,7 @@ describe('Api', () => {
...
@@ -724,7 +724,7 @@ describe('Api', () => {
},
},
]);
]);
Api
.
userProjects
(
userId
,
query
,
options
,
response
=>
{
Api
.
userProjects
(
userId
,
query
,
options
,
(
response
)
=>
{
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
.
length
).
toBe
(
1
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
response
[
0
].
name
).
toBe
(
'
test
'
);
done
();
done
();
...
@@ -733,7 +733,7 @@ describe('Api', () => {
...
@@ -733,7 +733,7 @@ describe('Api', () => {
});
});
describe
(
'
commitPipelines
'
,
()
=>
{
describe
(
'
commitPipelines
'
,
()
=>
{
it
(
'
fetches pipelines for a given commit
'
,
done
=>
{
it
(
'
fetches pipelines for a given commit
'
,
(
done
)
=>
{
const
projectId
=
'
example/foobar
'
;
const
projectId
=
'
example/foobar
'
;
const
commitSha
=
'
abc123def
'
;
const
commitSha
=
'
abc123def
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/
${
projectId
}
/commit/
${
commitSha
}
/pipelines`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/
${
projectId
}
/commit/
${
commitSha
}
/pipelines`
;
...
@@ -756,7 +756,7 @@ describe('Api', () => {
...
@@ -756,7 +756,7 @@ describe('Api', () => {
describe
(
'
pipelineJobs
'
,
()
=>
{
describe
(
'
pipelineJobs
'
,
()
=>
{
it
.
each
([
undefined
,
{},
{
foo
:
true
}])(
it
.
each
([
undefined
,
{},
{
foo
:
true
}])(
'
fetches the jobs for a given pipeline given %p params
'
,
'
fetches the jobs for a given pipeline given %p params
'
,
async
params
=>
{
async
(
params
)
=>
{
const
projectId
=
123
;
const
projectId
=
123
;
const
pipelineId
=
456
;
const
pipelineId
=
456
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectId
}
/pipelines/
${
pipelineId
}
/jobs`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectId
}
/pipelines/
${
pipelineId
}
/jobs`
;
...
@@ -774,7 +774,7 @@ describe('Api', () => {
...
@@ -774,7 +774,7 @@ describe('Api', () => {
});
});
describe
(
'
createBranch
'
,
()
=>
{
describe
(
'
createBranch
'
,
()
=>
{
it
(
'
creates new branch
'
,
done
=>
{
it
(
'
creates new branch
'
,
(
done
)
=>
{
const
ref
=
'
master
'
;
const
ref
=
'
master
'
;
const
branch
=
'
new-branch-name
'
;
const
branch
=
'
new-branch-name
'
;
const
dummyProjectPath
=
'
gitlab-org/gitlab-ce
'
;
const
dummyProjectPath
=
'
gitlab-org/gitlab-ce
'
;
...
@@ -799,7 +799,7 @@ describe('Api', () => {
...
@@ -799,7 +799,7 @@ describe('Api', () => {
});
});
describe
(
'
projectForks
'
,
()
=>
{
describe
(
'
projectForks
'
,
()
=>
{
it
(
'
gets forked projects
'
,
done
=>
{
it
(
'
gets forked projects
'
,
(
done
)
=>
{
const
dummyProjectPath
=
'
gitlab-org/gitlab-ce
'
;
const
dummyProjectPath
=
'
gitlab-org/gitlab-ce
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
encodeURIComponent
(
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
encodeURIComponent
(
dummyProjectPath
,
dummyProjectPath
,
...
@@ -822,7 +822,7 @@ describe('Api', () => {
...
@@ -822,7 +822,7 @@ describe('Api', () => {
});
});
describe
(
'
createContextCommits
'
,
()
=>
{
describe
(
'
createContextCommits
'
,
()
=>
{
it
(
'
creates a new context commit
'
,
done
=>
{
it
(
'
creates a new context commit
'
,
(
done
)
=>
{
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
mergeRequestId
=
'
123456
'
;
const
mergeRequestId
=
'
123456
'
;
const
commitsData
=
[
'
abcdefg
'
];
const
commitsData
=
[
'
abcdefg
'
];
...
@@ -851,7 +851,7 @@ describe('Api', () => {
...
@@ -851,7 +851,7 @@ describe('Api', () => {
});
});
describe
(
'
allContextCommits
'
,
()
=>
{
describe
(
'
allContextCommits
'
,
()
=>
{
it
(
'
gets all context commits
'
,
done
=>
{
it
(
'
gets all context commits
'
,
(
done
)
=>
{
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
mergeRequestId
=
'
123456
'
;
const
mergeRequestId
=
'
123456
'
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
/context_commits`
;
const
expectedUrl
=
`
${
dummyUrlRoot
}
/api/
${
dummyApiVersion
}
/projects/
${
projectPath
}
/merge_requests/
${
mergeRequestId
}
/context_commits`
;
...
@@ -872,7 +872,7 @@ describe('Api', () => {
...
@@ -872,7 +872,7 @@ describe('Api', () => {
});
});
describe
(
'
removeContextCommits
'
,
()
=>
{
describe
(
'
removeContextCommits
'
,
()
=>
{
it
(
'
removes context commits
'
,
done
=>
{
it
(
'
removes context commits
'
,
(
done
)
=>
{
const
projectPath
=
'
abc
'
;
const
projectPath
=
'
abc
'
;
const
mergeRequestId
=
'
123456
'
;
const
mergeRequestId
=
'
123456
'
;
const
commitsData
=
[
'
abcdefg
'
];
const
commitsData
=
[
'
abcdefg
'
];
...
@@ -1120,7 +1120,7 @@ describe('Api', () => {
...
@@ -1120,7 +1120,7 @@ describe('Api', () => {
});
});
describe
(
'
updateIssue
'
,
()
=>
{
describe
(
'
updateIssue
'
,
()
=>
{
it
(
'
update an issue with the given payload
'
,
done
=>
{
it
(
'
update an issue with the given payload
'
,
(
done
)
=>
{
const
projectId
=
8
;
const
projectId
=
8
;
const
issue
=
1
;
const
issue
=
1
;
const
expectedArray
=
[
1
,
2
,
3
];
const
expectedArray
=
[
1
,
2
,
3
];
...
@@ -1137,7 +1137,7 @@ describe('Api', () => {
...
@@ -1137,7 +1137,7 @@ describe('Api', () => {
});
});
describe
(
'
updateMergeRequest
'
,
()
=>
{
describe
(
'
updateMergeRequest
'
,
()
=>
{
it
(
'
update an issue with the given payload
'
,
done
=>
{
it
(
'
update an issue with the given payload
'
,
(
done
)
=>
{
const
projectId
=
8
;
const
projectId
=
8
;
const
mergeRequest
=
1
;
const
mergeRequest
=
1
;
const
expectedArray
=
[
1
,
2
,
3
];
const
expectedArray
=
[
1
,
2
,
3
];
...
@@ -1154,7 +1154,7 @@ describe('Api', () => {
...
@@ -1154,7 +1154,7 @@ describe('Api', () => {
});
});
describe
(
'
tags
'
,
()
=>
{
describe
(
'
tags
'
,
()
=>
{
it
(
'
fetches all tags of a particular project
'
,
done
=>
{
it
(
'
fetches all tags of a particular project
'
,
(
done
)
=>
{
const
query
=
'
dummy query
'
;
const
query
=
'
dummy query
'
;
const
options
=
{
unused
:
'
option
'
};
const
options
=
{
unused
:
'
option
'
};
const
projectId
=
8
;
const
projectId
=
8
;
...
...
spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js
View file @
e3aca8c8
...
@@ -34,8 +34,8 @@ describe('RecoveryCodes', () => {
...
@@ -34,8 +34,8 @@ describe('RecoveryCodes', () => {
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findRecoveryCodes
=
()
=>
wrapper
.
findByTestId
(
'
recovery-codes
'
);
const
findRecoveryCodes
=
()
=>
wrapper
.
findByTestId
(
'
recovery-codes
'
);
const
findCopyButton
=
()
=>
wrapper
.
find
(
ClipboardButton
);
const
findCopyButton
=
()
=>
wrapper
.
find
(
ClipboardButton
);
const
findButtonByText
=
text
=>
const
findButtonByText
=
(
text
)
=>
wrapper
.
findAll
(
GlButton
).
wrappers
.
find
(
buttonWrapper
=>
buttonWrapper
.
text
()
===
text
);
wrapper
.
findAll
(
GlButton
).
wrappers
.
find
(
(
buttonWrapper
)
=>
buttonWrapper
.
text
()
===
text
);
const
findDownloadButton
=
()
=>
findButtonByText
(
'
Download codes
'
);
const
findDownloadButton
=
()
=>
findButtonByText
(
'
Download codes
'
);
const
findPrintButton
=
()
=>
findButtonByText
(
'
Print codes
'
);
const
findPrintButton
=
()
=>
findButtonByText
(
'
Print codes
'
);
const
findProceedButton
=
()
=>
findButtonByText
(
'
Proceed
'
);
const
findProceedButton
=
()
=>
findButtonByText
(
'
Proceed
'
);
...
@@ -59,7 +59,7 @@ describe('RecoveryCodes', () => {
...
@@ -59,7 +59,7 @@ describe('RecoveryCodes', () => {
it
(
'
renders codes
'
,
()
=>
{
it
(
'
renders codes
'
,
()
=>
{
const
recoveryCodes
=
findRecoveryCodes
().
text
();
const
recoveryCodes
=
findRecoveryCodes
().
text
();
codes
.
forEach
(
code
=>
{
codes
.
forEach
(
(
code
)
=>
{
expect
(
recoveryCodes
).
toContain
(
code
);
expect
(
recoveryCodes
).
toContain
(
code
);
});
});
});
});
...
...
spec/frontend/authentication/u2f/authenticate_spec.js
View file @
e3aca8c8
...
@@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => {
...
@@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => {
window
.
u2f
=
oldu2f
;
window
.
u2f
=
oldu2f
;
});
});
it
(
'
falls back to normal 2fa
'
,
done
=>
{
it
(
'
falls back to normal 2fa
'
,
(
done
)
=>
{
component
component
.
start
()
.
start
()
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => {
...
@@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => {
});
});
describe
(
'
with u2f available
'
,
()
=>
{
describe
(
'
with u2f available
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
// bypass automatic form submission within renderAuthenticated
// bypass automatic form submission within renderAuthenticated
jest
.
spyOn
(
component
,
'
renderAuthenticated
'
).
mockReturnValue
(
true
);
jest
.
spyOn
(
component
,
'
renderAuthenticated
'
).
mockReturnValue
(
true
);
u2fDevice
=
new
MockU2FDevice
();
u2fDevice
=
new
MockU2FDevice
();
...
...
spec/frontend/authentication/u2f/register_spec.js
View file @
e3aca8c8
...
@@ -10,7 +10,7 @@ describe('U2FRegister', () => {
...
@@ -10,7 +10,7 @@ describe('U2FRegister', () => {
preloadFixtures
(
'
u2f/register.html
'
);
preloadFixtures
(
'
u2f/register.html
'
);
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
loadFixtures
(
'
u2f/register.html
'
);
loadFixtures
(
'
u2f/register.html
'
);
u2fDevice
=
new
MockU2FDevice
();
u2fDevice
=
new
MockU2FDevice
();
container
=
$
(
'
#js-register-token-2fa
'
);
container
=
$
(
'
#js-register-token-2fa
'
);
...
...
spec/frontend/awards_handler_spec.js
View file @
e3aca8c8
...
@@ -63,7 +63,7 @@ describe('AwardsHandler', () => {
...
@@ -63,7 +63,7 @@ describe('AwardsHandler', () => {
const
$menu
=
$
(
'
.emoji-menu
'
);
const
$menu
=
$
(
'
.emoji-menu
'
);
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
(
resolve
)
=>
{
$menu
.
one
(
'
build-emoji-menu-finish
'
,
()
=>
{
$menu
.
one
(
'
build-emoji-menu-finish
'
,
()
=>
{
resolve
();
resolve
();
});
});
...
@@ -356,7 +356,7 @@ describe('AwardsHandler', () => {
...
@@ -356,7 +356,7 @@ describe('AwardsHandler', () => {
await
openAndWaitForEmojiMenu
();
await
openAndWaitForEmojiMenu
();
const
emojiMenu
=
document
.
querySelector
(
'
.emoji-menu
'
);
const
emojiMenu
=
document
.
querySelector
(
'
.emoji-menu
'
);
Array
.
prototype
.
forEach
.
call
(
emojiMenu
.
querySelectorAll
(
'
.emoji-menu-title
'
),
title
=>
{
Array
.
prototype
.
forEach
.
call
(
emojiMenu
.
querySelectorAll
(
'
.emoji-menu-title
'
),
(
title
)
=>
{
expect
(
title
.
textContent
.
trim
().
toLowerCase
()).
not
.
toBe
(
'
frequently used
'
);
expect
(
title
.
textContent
.
trim
().
toLowerCase
()).
not
.
toBe
(
'
frequently used
'
);
});
});
});
});
...
@@ -369,7 +369,7 @@ describe('AwardsHandler', () => {
...
@@ -369,7 +369,7 @@ describe('AwardsHandler', () => {
const
emojiMenu
=
document
.
querySelector
(
'
.emoji-menu
'
);
const
emojiMenu
=
document
.
querySelector
(
'
.emoji-menu
'
);
const
hasFrequentlyUsedHeading
=
Array
.
prototype
.
some
.
call
(
const
hasFrequentlyUsedHeading
=
Array
.
prototype
.
some
.
call
(
emojiMenu
.
querySelectorAll
(
'
.emoji-menu-title
'
),
emojiMenu
.
querySelectorAll
(
'
.emoji-menu-title
'
),
title
=>
title
.
textContent
.
trim
().
toLowerCase
()
===
'
frequently used
'
,
(
title
)
=>
title
.
textContent
.
trim
().
toLowerCase
()
===
'
frequently used
'
,
);
);
expect
(
hasFrequentlyUsedHeading
).
toBe
(
true
);
expect
(
hasFrequentlyUsedHeading
).
toBe
(
true
);
...
...
spec/frontend/badges/components/badge_form_spec.js
View file @
e3aca8c8
...
@@ -50,7 +50,7 @@ describe('BadgeForm component', () => {
...
@@ -50,7 +50,7 @@ describe('BadgeForm component', () => {
});
});
});
});
const
sharedSubmitTests
=
submitAction
=>
{
const
sharedSubmitTests
=
(
submitAction
)
=>
{
const
nameSelector
=
'
#badge-name
'
;
const
nameSelector
=
'
#badge-name
'
;
const
imageUrlSelector
=
'
#badge-image-url
'
;
const
imageUrlSelector
=
'
#badge-image-url
'
;
const
findImageUrlElement
=
()
=>
vm
.
$el
.
querySelector
(
imageUrlSelector
);
const
findImageUrlElement
=
()
=>
vm
.
$el
.
querySelector
(
imageUrlSelector
);
...
@@ -65,7 +65,7 @@ describe('BadgeForm component', () => {
...
@@ -65,7 +65,7 @@ describe('BadgeForm component', () => {
const
submitButton
=
vm
.
$el
.
querySelector
(
'
button[type="submit"]
'
);
const
submitButton
=
vm
.
$el
.
querySelector
(
'
button[type="submit"]
'
);
submitButton
.
click
();
submitButton
.
click
();
};
};
const
expectInvalidInput
=
inputElementSelector
=>
{
const
expectInvalidInput
=
(
inputElementSelector
)
=>
{
const
inputElement
=
vm
.
$el
.
querySelector
(
inputElementSelector
);
const
inputElement
=
vm
.
$el
.
querySelector
(
inputElementSelector
);
expect
(
inputElement
.
checkValidity
()).
toBe
(
false
);
expect
(
inputElement
.
checkValidity
()).
toBe
(
false
);
...
@@ -74,7 +74,7 @@ describe('BadgeForm component', () => {
...
@@ -74,7 +74,7 @@ describe('BadgeForm component', () => {
expect
(
feedbackElement
).
toBeVisible
();
expect
(
feedbackElement
).
toBeVisible
();
};
};
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
vm
,
submitAction
).
mockReturnValue
(
Promise
.
resolve
());
jest
.
spyOn
(
vm
,
submitAction
).
mockReturnValue
(
Promise
.
resolve
());
store
.
replaceState
({
store
.
replaceState
({
...
store
.
state
,
...
store
.
state
,
...
...
spec/frontend/badges/components/badge_list_row_spec.js
View file @
e3aca8c8
...
@@ -73,7 +73,7 @@ describe('BadgeListRow component', () => {
...
@@ -73,7 +73,7 @@ describe('BadgeListRow component', () => {
expect
(
vm
.
editBadge
).
toHaveBeenCalled
();
expect
(
vm
.
editBadge
).
toHaveBeenCalled
();
});
});
it
(
'
calls updateBadgeInModal and shows modal when clicking then delete button
'
,
done
=>
{
it
(
'
calls updateBadgeInModal and shows modal when clicking then delete button
'
,
(
done
)
=>
{
jest
.
spyOn
(
vm
,
'
updateBadgeInModal
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
updateBadgeInModal
'
).
mockImplementation
(()
=>
{});
const
deleteButton
=
vm
.
$el
.
querySelector
(
'
.table-button-footer button:last-of-type
'
);
const
deleteButton
=
vm
.
$el
.
querySelector
(
'
.table-button-footer button:last-of-type
'
);
...
@@ -88,7 +88,7 @@ describe('BadgeListRow component', () => {
...
@@ -88,7 +88,7 @@ describe('BadgeListRow component', () => {
});
});
describe
(
'
for a group badge
'
,
()
=>
{
describe
(
'
for a group badge
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
badge
.
kind
=
GROUP_BADGE
;
badge
.
kind
=
GROUP_BADGE
;
Vue
.
nextTick
().
then
(
done
).
catch
(
done
.
fail
);
Vue
.
nextTick
().
then
(
done
).
catch
(
done
.
fail
);
...
...
spec/frontend/badges/components/badge_list_spec.js
View file @
e3aca8c8
...
@@ -48,7 +48,7 @@ describe('BadgeList component', () => {
...
@@ -48,7 +48,7 @@ describe('BadgeList component', () => {
expect
(
rows
).
toHaveLength
(
numberOfDummyBadges
);
expect
(
rows
).
toHaveLength
(
numberOfDummyBadges
);
});
});
it
(
'
renders a message if no badges exist
'
,
done
=>
{
it
(
'
renders a message if no badges exist
'
,
(
done
)
=>
{
store
.
state
.
badges
=
[];
store
.
state
.
badges
=
[];
Vue
.
nextTick
()
Vue
.
nextTick
()
...
@@ -59,7 +59,7 @@ describe('BadgeList component', () => {
...
@@ -59,7 +59,7 @@ describe('BadgeList component', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
shows a loading icon when loading
'
,
done
=>
{
it
(
'
shows a loading icon when loading
'
,
(
done
)
=>
{
store
.
state
.
isLoading
=
true
;
store
.
state
.
isLoading
=
true
;
Vue
.
nextTick
()
Vue
.
nextTick
()
...
@@ -73,13 +73,13 @@ describe('BadgeList component', () => {
...
@@ -73,13 +73,13 @@ describe('BadgeList component', () => {
});
});
describe
(
'
for group badges
'
,
()
=>
{
describe
(
'
for group badges
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
store
.
state
.
kind
=
GROUP_BADGE
;
store
.
state
.
kind
=
GROUP_BADGE
;
Vue
.
nextTick
().
then
(
done
).
catch
(
done
.
fail
);
Vue
.
nextTick
().
then
(
done
).
catch
(
done
.
fail
);
});
});
it
(
'
renders a message if no badges exist
'
,
done
=>
{
it
(
'
renders a message if no badges exist
'
,
(
done
)
=>
{
store
.
state
.
badges
=
[];
store
.
state
.
badges
=
[];
Vue
.
nextTick
()
Vue
.
nextTick
()
...
...
spec/frontend/badges/components/badge_spec.js
View file @
e3aca8c8
...
@@ -23,7 +23,7 @@ describe('Badge component', () => {
...
@@ -23,7 +23,7 @@ describe('Badge component', () => {
const
createComponent
=
(
props
,
el
=
null
)
=>
{
const
createComponent
=
(
props
,
el
=
null
)
=>
{
vm
=
mountComponent
(
Component
,
props
,
el
);
vm
=
mountComponent
(
Component
,
props
,
el
);
const
{
badgeImage
}
=
findElements
();
const
{
badgeImage
}
=
findElements
();
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
(
resolve
)
=>
{
badgeImage
.
addEventListener
(
'
load
'
,
resolve
);
badgeImage
.
addEventListener
(
'
load
'
,
resolve
);
// Manually dispatch load event as it is not triggered
// Manually dispatch load event as it is not triggered
badgeImage
.
dispatchEvent
(
new
Event
(
'
load
'
));
badgeImage
.
dispatchEvent
(
new
Event
(
'
load
'
));
...
@@ -36,7 +36,7 @@ describe('Badge component', () => {
...
@@ -36,7 +36,7 @@ describe('Badge component', () => {
describe
(
'
watchers
'
,
()
=>
{
describe
(
'
watchers
'
,
()
=>
{
describe
(
'
imageUrl
'
,
()
=>
{
describe
(
'
imageUrl
'
,
()
=>
{
it
(
'
sets isLoading and resets numRetries and hasError
'
,
done
=>
{
it
(
'
sets isLoading and resets numRetries and hasError
'
,
(
done
)
=>
{
const
props
=
{
...
dummyProps
};
const
props
=
{
...
dummyProps
};
createComponent
(
props
)
createComponent
(
props
)
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -60,7 +60,7 @@ describe('Badge component', () => {
...
@@ -60,7 +60,7 @@ describe('Badge component', () => {
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
createComponent
({
...
dummyProps
})
createComponent
({
...
dummyProps
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
@@ -98,7 +98,7 @@ describe('Badge component', () => {
...
@@ -98,7 +98,7 @@ describe('Badge component', () => {
});
});
describe
(
'
behavior
'
,
()
=>
{
describe
(
'
behavior
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
setFixtures
(
'
<div id="dummy-element"></div>
'
);
setFixtures
(
'
<div id="dummy-element"></div>
'
);
createComponent
({
...
dummyProps
},
'
#dummy-element
'
)
createComponent
({
...
dummyProps
},
'
#dummy-element
'
)
.
then
(
done
)
.
then
(
done
)
...
@@ -116,7 +116,7 @@ describe('Badge component', () => {
...
@@ -116,7 +116,7 @@ describe('Badge component', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.btn-group
'
)).
toBeHidden
();
expect
(
vm
.
$el
.
querySelector
(
'
.btn-group
'
)).
toBeHidden
();
});
});
it
(
'
shows a loading icon when loading
'
,
done
=>
{
it
(
'
shows a loading icon when loading
'
,
(
done
)
=>
{
vm
.
isLoading
=
true
;
vm
.
isLoading
=
true
;
Vue
.
nextTick
()
Vue
.
nextTick
()
...
@@ -132,7 +132,7 @@ describe('Badge component', () => {
...
@@ -132,7 +132,7 @@ describe('Badge component', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
shows an error and reload button if loading failed
'
,
done
=>
{
it
(
'
shows an error and reload button if loading failed
'
,
(
done
)
=>
{
vm
.
hasError
=
true
;
vm
.
hasError
=
true
;
Vue
.
nextTick
()
Vue
.
nextTick
()
...
...
spec/frontend/badges/store/actions_spec.js
View file @
e3aca8c8
...
@@ -33,7 +33,7 @@ describe('Badges store actions', () => {
...
@@ -33,7 +33,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
requestNewBadge
'
,
()
=>
{
describe
(
'
requestNewBadge
'
,
()
=>
{
it
(
'
commits REQUEST_NEW_BADGE
'
,
done
=>
{
it
(
'
commits REQUEST_NEW_BADGE
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
requestNewBadge
,
actions
.
requestNewBadge
,
null
,
null
,
...
@@ -46,7 +46,7 @@ describe('Badges store actions', () => {
...
@@ -46,7 +46,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveNewBadge
'
,
()
=>
{
describe
(
'
receiveNewBadge
'
,
()
=>
{
it
(
'
commits RECEIVE_NEW_BADGE
'
,
done
=>
{
it
(
'
commits RECEIVE_NEW_BADGE
'
,
(
done
)
=>
{
const
newBadge
=
createDummyBadge
();
const
newBadge
=
createDummyBadge
();
testAction
(
testAction
(
actions
.
receiveNewBadge
,
actions
.
receiveNewBadge
,
...
@@ -60,7 +60,7 @@ describe('Badges store actions', () => {
...
@@ -60,7 +60,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveNewBadgeError
'
,
()
=>
{
describe
(
'
receiveNewBadgeError
'
,
()
=>
{
it
(
'
commits RECEIVE_NEW_BADGE_ERROR
'
,
done
=>
{
it
(
'
commits RECEIVE_NEW_BADGE_ERROR
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveNewBadgeError
,
actions
.
receiveNewBadgeError
,
null
,
null
,
...
@@ -87,10 +87,10 @@ describe('Badges store actions', () => {
...
@@ -87,10 +87,10 @@ describe('Badges store actions', () => {
};
};
});
});
it
(
'
dispatches requestNewBadge and receiveNewBadge for successful response
'
,
done
=>
{
it
(
'
dispatches requestNewBadge and receiveNewBadge for successful response
'
,
(
done
)
=>
{
const
dummyResponse
=
createDummyBadgeResponse
();
const
dummyResponse
=
createDummyBadgeResponse
();
endpointMock
.
replyOnce
(
req
=>
{
endpointMock
.
replyOnce
(
(
req
)
=>
{
expect
(
req
.
data
).
toBe
(
expect
(
req
.
data
).
toBe
(
JSON
.
stringify
({
JSON
.
stringify
({
name
:
'
TestBadge
'
,
name
:
'
TestBadge
'
,
...
@@ -114,8 +114,8 @@ describe('Badges store actions', () => {
...
@@ -114,8 +114,8 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches requestNewBadge and receiveNewBadgeError for error response
'
,
done
=>
{
it
(
'
dispatches requestNewBadge and receiveNewBadgeError for error response
'
,
(
done
)
=>
{
endpointMock
.
replyOnce
(
req
=>
{
endpointMock
.
replyOnce
(
(
req
)
=>
{
expect
(
req
.
data
).
toBe
(
expect
(
req
.
data
).
toBe
(
JSON
.
stringify
({
JSON
.
stringify
({
name
:
'
TestBadge
'
,
name
:
'
TestBadge
'
,
...
@@ -141,7 +141,7 @@ describe('Badges store actions', () => {
...
@@ -141,7 +141,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
requestDeleteBadge
'
,
()
=>
{
describe
(
'
requestDeleteBadge
'
,
()
=>
{
it
(
'
commits REQUEST_DELETE_BADGE
'
,
done
=>
{
it
(
'
commits REQUEST_DELETE_BADGE
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
requestDeleteBadge
,
actions
.
requestDeleteBadge
,
badgeId
,
badgeId
,
...
@@ -154,7 +154,7 @@ describe('Badges store actions', () => {
...
@@ -154,7 +154,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveDeleteBadge
'
,
()
=>
{
describe
(
'
receiveDeleteBadge
'
,
()
=>
{
it
(
'
commits RECEIVE_DELETE_BADGE
'
,
done
=>
{
it
(
'
commits RECEIVE_DELETE_BADGE
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveDeleteBadge
,
actions
.
receiveDeleteBadge
,
badgeId
,
badgeId
,
...
@@ -167,7 +167,7 @@ describe('Badges store actions', () => {
...
@@ -167,7 +167,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveDeleteBadgeError
'
,
()
=>
{
describe
(
'
receiveDeleteBadgeError
'
,
()
=>
{
it
(
'
commits RECEIVE_DELETE_BADGE_ERROR
'
,
done
=>
{
it
(
'
commits RECEIVE_DELETE_BADGE_ERROR
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveDeleteBadgeError
,
actions
.
receiveDeleteBadgeError
,
badgeId
,
badgeId
,
...
@@ -188,7 +188,7 @@ describe('Badges store actions', () => {
...
@@ -188,7 +188,7 @@ describe('Badges store actions', () => {
dispatch
=
jest
.
fn
();
dispatch
=
jest
.
fn
();
});
});
it
(
'
dispatches requestDeleteBadge and receiveDeleteBadge for successful response
'
,
done
=>
{
it
(
'
dispatches requestDeleteBadge and receiveDeleteBadge for successful response
'
,
(
done
)
=>
{
endpointMock
.
replyOnce
(()
=>
{
endpointMock
.
replyOnce
(()
=>
{
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestDeleteBadge
'
,
badgeId
]]);
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestDeleteBadge
'
,
badgeId
]]);
dispatch
.
mockClear
();
dispatch
.
mockClear
();
...
@@ -204,7 +204,7 @@ describe('Badges store actions', () => {
...
@@ -204,7 +204,7 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches requestDeleteBadge and receiveDeleteBadgeError for error response
'
,
done
=>
{
it
(
'
dispatches requestDeleteBadge and receiveDeleteBadgeError for error response
'
,
(
done
)
=>
{
endpointMock
.
replyOnce
(()
=>
{
endpointMock
.
replyOnce
(()
=>
{
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestDeleteBadge
'
,
badgeId
]]);
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestDeleteBadge
'
,
badgeId
]]);
dispatch
.
mockClear
();
dispatch
.
mockClear
();
...
@@ -223,7 +223,7 @@ describe('Badges store actions', () => {
...
@@ -223,7 +223,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
editBadge
'
,
()
=>
{
describe
(
'
editBadge
'
,
()
=>
{
it
(
'
commits START_EDITING
'
,
done
=>
{
it
(
'
commits START_EDITING
'
,
(
done
)
=>
{
const
dummyBadge
=
createDummyBadge
();
const
dummyBadge
=
createDummyBadge
();
testAction
(
testAction
(
actions
.
editBadge
,
actions
.
editBadge
,
...
@@ -237,7 +237,7 @@ describe('Badges store actions', () => {
...
@@ -237,7 +237,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
requestLoadBadges
'
,
()
=>
{
describe
(
'
requestLoadBadges
'
,
()
=>
{
it
(
'
commits REQUEST_LOAD_BADGES
'
,
done
=>
{
it
(
'
commits REQUEST_LOAD_BADGES
'
,
(
done
)
=>
{
const
dummyData
=
'
this is not real data
'
;
const
dummyData
=
'
this is not real data
'
;
testAction
(
testAction
(
actions
.
requestLoadBadges
,
actions
.
requestLoadBadges
,
...
@@ -251,7 +251,7 @@ describe('Badges store actions', () => {
...
@@ -251,7 +251,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveLoadBadges
'
,
()
=>
{
describe
(
'
receiveLoadBadges
'
,
()
=>
{
it
(
'
commits RECEIVE_LOAD_BADGES
'
,
done
=>
{
it
(
'
commits RECEIVE_LOAD_BADGES
'
,
(
done
)
=>
{
const
badges
=
dummyBadges
;
const
badges
=
dummyBadges
;
testAction
(
testAction
(
actions
.
receiveLoadBadges
,
actions
.
receiveLoadBadges
,
...
@@ -265,7 +265,7 @@ describe('Badges store actions', () => {
...
@@ -265,7 +265,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveLoadBadgesError
'
,
()
=>
{
describe
(
'
receiveLoadBadgesError
'
,
()
=>
{
it
(
'
commits RECEIVE_LOAD_BADGES_ERROR
'
,
done
=>
{
it
(
'
commits RECEIVE_LOAD_BADGES_ERROR
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveLoadBadgesError
,
actions
.
receiveLoadBadgesError
,
null
,
null
,
...
@@ -286,7 +286,7 @@ describe('Badges store actions', () => {
...
@@ -286,7 +286,7 @@ describe('Badges store actions', () => {
dispatch
=
jest
.
fn
();
dispatch
=
jest
.
fn
();
});
});
it
(
'
dispatches requestLoadBadges and receiveLoadBadges for successful response
'
,
done
=>
{
it
(
'
dispatches requestLoadBadges and receiveLoadBadges for successful response
'
,
(
done
)
=>
{
const
dummyData
=
'
this is just some data
'
;
const
dummyData
=
'
this is just some data
'
;
const
dummyReponse
=
[
const
dummyReponse
=
[
createDummyBadgeResponse
(),
createDummyBadgeResponse
(),
...
@@ -310,7 +310,7 @@ describe('Badges store actions', () => {
...
@@ -310,7 +310,7 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches requestLoadBadges and receiveLoadBadgesError for error response
'
,
done
=>
{
it
(
'
dispatches requestLoadBadges and receiveLoadBadgesError for error response
'
,
(
done
)
=>
{
const
dummyData
=
'
this is just some data
'
;
const
dummyData
=
'
this is just some data
'
;
endpointMock
.
replyOnce
(()
=>
{
endpointMock
.
replyOnce
(()
=>
{
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestLoadBadges
'
,
dummyData
]]);
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestLoadBadges
'
,
dummyData
]]);
...
@@ -330,7 +330,7 @@ describe('Badges store actions', () => {
...
@@ -330,7 +330,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
requestRenderedBadge
'
,
()
=>
{
describe
(
'
requestRenderedBadge
'
,
()
=>
{
it
(
'
commits REQUEST_RENDERED_BADGE
'
,
done
=>
{
it
(
'
commits REQUEST_RENDERED_BADGE
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
requestRenderedBadge
,
actions
.
requestRenderedBadge
,
null
,
null
,
...
@@ -343,7 +343,7 @@ describe('Badges store actions', () => {
...
@@ -343,7 +343,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveRenderedBadge
'
,
()
=>
{
describe
(
'
receiveRenderedBadge
'
,
()
=>
{
it
(
'
commits RECEIVE_RENDERED_BADGE
'
,
done
=>
{
it
(
'
commits RECEIVE_RENDERED_BADGE
'
,
(
done
)
=>
{
const
dummyBadge
=
createDummyBadge
();
const
dummyBadge
=
createDummyBadge
();
testAction
(
testAction
(
actions
.
receiveRenderedBadge
,
actions
.
receiveRenderedBadge
,
...
@@ -357,7 +357,7 @@ describe('Badges store actions', () => {
...
@@ -357,7 +357,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveRenderedBadgeError
'
,
()
=>
{
describe
(
'
receiveRenderedBadgeError
'
,
()
=>
{
it
(
'
commits RECEIVE_RENDERED_BADGE_ERROR
'
,
done
=>
{
it
(
'
commits RECEIVE_RENDERED_BADGE_ERROR
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveRenderedBadgeError
,
actions
.
receiveRenderedBadgeError
,
null
,
null
,
...
@@ -388,7 +388,7 @@ describe('Badges store actions', () => {
...
@@ -388,7 +388,7 @@ describe('Badges store actions', () => {
dispatch
=
jest
.
fn
();
dispatch
=
jest
.
fn
();
});
});
it
(
'
returns immediately if imageUrl is empty
'
,
done
=>
{
it
(
'
returns immediately if imageUrl is empty
'
,
(
done
)
=>
{
jest
.
spyOn
(
axios
,
'
get
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
axios
,
'
get
'
).
mockImplementation
(()
=>
{});
badgeInForm
.
imageUrl
=
''
;
badgeInForm
.
imageUrl
=
''
;
...
@@ -401,7 +401,7 @@ describe('Badges store actions', () => {
...
@@ -401,7 +401,7 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
returns immediately if linkUrl is empty
'
,
done
=>
{
it
(
'
returns immediately if linkUrl is empty
'
,
(
done
)
=>
{
jest
.
spyOn
(
axios
,
'
get
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
axios
,
'
get
'
).
mockImplementation
(()
=>
{});
badgeInForm
.
linkUrl
=
''
;
badgeInForm
.
linkUrl
=
''
;
...
@@ -414,7 +414,7 @@ describe('Badges store actions', () => {
...
@@ -414,7 +414,7 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
escapes user input
'
,
done
=>
{
it
(
'
escapes user input
'
,
(
done
)
=>
{
jest
jest
.
spyOn
(
axios
,
'
get
'
)
.
spyOn
(
axios
,
'
get
'
)
.
mockImplementation
(()
=>
Promise
.
resolve
({
data
:
createDummyBadgeResponse
()
}));
.
mockImplementation
(()
=>
Promise
.
resolve
({
data
:
createDummyBadgeResponse
()
}));
...
@@ -437,7 +437,7 @@ describe('Badges store actions', () => {
...
@@ -437,7 +437,7 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches requestRenderedBadge and receiveRenderedBadge for successful response
'
,
done
=>
{
it
(
'
dispatches requestRenderedBadge and receiveRenderedBadge for successful response
'
,
(
done
)
=>
{
const
dummyReponse
=
createDummyBadgeResponse
();
const
dummyReponse
=
createDummyBadgeResponse
();
endpointMock
.
replyOnce
(()
=>
{
endpointMock
.
replyOnce
(()
=>
{
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestRenderedBadge
'
]]);
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestRenderedBadge
'
]]);
...
@@ -456,7 +456,7 @@ describe('Badges store actions', () => {
...
@@ -456,7 +456,7 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches requestRenderedBadge and receiveRenderedBadgeError for error response
'
,
done
=>
{
it
(
'
dispatches requestRenderedBadge and receiveRenderedBadgeError for error response
'
,
(
done
)
=>
{
endpointMock
.
replyOnce
(()
=>
{
endpointMock
.
replyOnce
(()
=>
{
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestRenderedBadge
'
]]);
expect
(
dispatch
.
mock
.
calls
).
toEqual
([[
'
requestRenderedBadge
'
]]);
dispatch
.
mockClear
();
dispatch
.
mockClear
();
...
@@ -475,7 +475,7 @@ describe('Badges store actions', () => {
...
@@ -475,7 +475,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
requestUpdatedBadge
'
,
()
=>
{
describe
(
'
requestUpdatedBadge
'
,
()
=>
{
it
(
'
commits REQUEST_UPDATED_BADGE
'
,
done
=>
{
it
(
'
commits REQUEST_UPDATED_BADGE
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
requestUpdatedBadge
,
actions
.
requestUpdatedBadge
,
null
,
null
,
...
@@ -488,7 +488,7 @@ describe('Badges store actions', () => {
...
@@ -488,7 +488,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveUpdatedBadge
'
,
()
=>
{
describe
(
'
receiveUpdatedBadge
'
,
()
=>
{
it
(
'
commits RECEIVE_UPDATED_BADGE
'
,
done
=>
{
it
(
'
commits RECEIVE_UPDATED_BADGE
'
,
(
done
)
=>
{
const
updatedBadge
=
createDummyBadge
();
const
updatedBadge
=
createDummyBadge
();
testAction
(
testAction
(
actions
.
receiveUpdatedBadge
,
actions
.
receiveUpdatedBadge
,
...
@@ -502,7 +502,7 @@ describe('Badges store actions', () => {
...
@@ -502,7 +502,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
receiveUpdatedBadgeError
'
,
()
=>
{
describe
(
'
receiveUpdatedBadgeError
'
,
()
=>
{
it
(
'
commits RECEIVE_UPDATED_BADGE_ERROR
'
,
done
=>
{
it
(
'
commits RECEIVE_UPDATED_BADGE_ERROR
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveUpdatedBadgeError
,
actions
.
receiveUpdatedBadgeError
,
null
,
null
,
...
@@ -529,10 +529,10 @@ describe('Badges store actions', () => {
...
@@ -529,10 +529,10 @@ describe('Badges store actions', () => {
dispatch
=
jest
.
fn
();
dispatch
=
jest
.
fn
();
});
});
it
(
'
dispatches requestUpdatedBadge and receiveUpdatedBadge for successful response
'
,
done
=>
{
it
(
'
dispatches requestUpdatedBadge and receiveUpdatedBadge for successful response
'
,
(
done
)
=>
{
const
dummyResponse
=
createDummyBadgeResponse
();
const
dummyResponse
=
createDummyBadgeResponse
();
endpointMock
.
replyOnce
(
req
=>
{
endpointMock
.
replyOnce
(
(
req
)
=>
{
expect
(
req
.
data
).
toBe
(
expect
(
req
.
data
).
toBe
(
JSON
.
stringify
({
JSON
.
stringify
({
name
:
'
TestBadge
'
,
name
:
'
TestBadge
'
,
...
@@ -556,8 +556,8 @@ describe('Badges store actions', () => {
...
@@ -556,8 +556,8 @@ describe('Badges store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches requestUpdatedBadge and receiveUpdatedBadgeError for error response
'
,
done
=>
{
it
(
'
dispatches requestUpdatedBadge and receiveUpdatedBadgeError for error response
'
,
(
done
)
=>
{
endpointMock
.
replyOnce
(
req
=>
{
endpointMock
.
replyOnce
(
(
req
)
=>
{
expect
(
req
.
data
).
toBe
(
expect
(
req
.
data
).
toBe
(
JSON
.
stringify
({
JSON
.
stringify
({
name
:
'
TestBadge
'
,
name
:
'
TestBadge
'
,
...
@@ -583,7 +583,7 @@ describe('Badges store actions', () => {
...
@@ -583,7 +583,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
stopEditing
'
,
()
=>
{
describe
(
'
stopEditing
'
,
()
=>
{
it
(
'
commits STOP_EDITING
'
,
done
=>
{
it
(
'
commits STOP_EDITING
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
stopEditing
,
actions
.
stopEditing
,
null
,
null
,
...
@@ -596,7 +596,7 @@ describe('Badges store actions', () => {
...
@@ -596,7 +596,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
updateBadgeInForm
'
,
()
=>
{
describe
(
'
updateBadgeInForm
'
,
()
=>
{
it
(
'
commits UPDATE_BADGE_IN_FORM
'
,
done
=>
{
it
(
'
commits UPDATE_BADGE_IN_FORM
'
,
(
done
)
=>
{
const
dummyBadge
=
createDummyBadge
();
const
dummyBadge
=
createDummyBadge
();
testAction
(
testAction
(
actions
.
updateBadgeInForm
,
actions
.
updateBadgeInForm
,
...
@@ -609,7 +609,7 @@ describe('Badges store actions', () => {
...
@@ -609,7 +609,7 @@ describe('Badges store actions', () => {
});
});
describe
(
'
updateBadgeInModal
'
,
()
=>
{
describe
(
'
updateBadgeInModal
'
,
()
=>
{
it
(
'
commits UPDATE_BADGE_IN_MODAL
'
,
done
=>
{
it
(
'
commits UPDATE_BADGE_IN_MODAL
'
,
(
done
)
=>
{
const
dummyBadge
=
createDummyBadge
();
const
dummyBadge
=
createDummyBadge
();
testAction
(
testAction
(
actions
.
updateBadgeInModal
,
actions
.
updateBadgeInModal
,
...
...
spec/frontend/batch_comments/components/draft_note_spec.js
View file @
e3aca8c8
...
@@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => {
...
@@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => {
);
);
});
});
it
(
'
sets as loading when draft is publishing
'
,
done
=>
{
it
(
'
sets as loading when draft is publishing
'
,
(
done
)
=>
{
createComponent
();
createComponent
();
wrapper
.
vm
.
$store
.
state
.
batchComments
.
currentlyPublishingDrafts
.
push
(
1
);
wrapper
.
vm
.
$store
.
state
.
batchComments
.
currentlyPublishingDrafts
.
push
(
1
);
...
@@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => {
...
@@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => {
});
});
describe
(
'
update
'
,
()
=>
{
describe
(
'
update
'
,
()
=>
{
it
(
'
dispatches updateDraft
'
,
done
=>
{
it
(
'
dispatches updateDraft
'
,
(
done
)
=>
{
createComponent
();
createComponent
();
const
note
=
wrapper
.
find
(
NoteableNote
);
const
note
=
wrapper
.
find
(
NoteableNote
);
...
@@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => {
...
@@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => {
});
});
describe
(
'
quick actions
'
,
()
=>
{
describe
(
'
quick actions
'
,
()
=>
{
it
(
'
renders referenced commands
'
,
done
=>
{
it
(
'
renders referenced commands
'
,
(
done
)
=>
{
createComponent
();
createComponent
();
wrapper
.
setProps
({
wrapper
.
setProps
({
draft
:
{
draft
:
{
...
...
spec/frontend/batch_comments/components/drafts_count_spec.js
View file @
e3aca8c8
...
@@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => {
...
@@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => {
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
1
'
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
1
'
);
});
});
it
(
'
renders screen reader text
'
,
done
=>
{
it
(
'
renders screen reader text
'
,
(
done
)
=>
{
const
el
=
vm
.
$el
.
querySelector
(
'
.sr-only
'
);
const
el
=
vm
.
$el
.
querySelector
(
'
.sr-only
'
);
expect
(
el
.
textContent
).
toContain
(
'
draft
'
);
expect
(
el
.
textContent
).
toContain
(
'
draft
'
);
...
...
spec/frontend/batch_comments/components/preview_item_spec.js
View file @
e3aca8c8
...
@@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => {
...
@@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => {
describe
(
'
for thread
'
,
()
=>
{
describe
(
'
for thread
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
(
false
,
{
discussion_id
:
'
1
'
,
resolve_discussion
:
true
},
store
=>
{
createComponent
(
false
,
{
discussion_id
:
'
1
'
,
resolve_discussion
:
true
},
(
store
)
=>
{
store
.
state
.
notes
.
discussions
.
push
({
store
.
state
.
notes
.
discussions
.
push
({
id
:
'
1
'
,
id
:
'
1
'
,
notes
:
[
notes
:
[
...
...
spec/frontend/batch_comments/components/publish_button_spec.js
View file @
e3aca8c8
...
@@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => {
...
@@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => {
expect
(
vm
.
$store
.
dispatch
).
toHaveBeenCalledWith
(
'
batchComments/publishReview
'
,
undefined
);
expect
(
vm
.
$store
.
dispatch
).
toHaveBeenCalledWith
(
'
batchComments/publishReview
'
,
undefined
);
});
});
it
(
'
sets loading when isPublishing is true
'
,
done
=>
{
it
(
'
sets loading when isPublishing is true
'
,
(
done
)
=>
{
vm
.
$store
.
state
.
batchComments
.
isPublishing
=
true
;
vm
.
$store
.
state
.
batchComments
.
isPublishing
=
true
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
...
...
spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
View file @
e3aca8c8
...
@@ -28,7 +28,7 @@ describe('Batch comments store actions', () => {
...
@@ -28,7 +28,7 @@ describe('Batch comments store actions', () => {
});
});
describe
(
'
addDraftToDiscussion
'
,
()
=>
{
describe
(
'
addDraftToDiscussion
'
,
()
=>
{
it
(
'
commits ADD_NEW_DRAFT if no errors returned
'
,
done
=>
{
it
(
'
commits ADD_NEW_DRAFT if no errors returned
'
,
(
done
)
=>
{
res
=
{
id
:
1
};
res
=
{
id
:
1
};
mock
.
onAny
().
reply
(
200
,
res
);
mock
.
onAny
().
reply
(
200
,
res
);
...
@@ -42,7 +42,7 @@ describe('Batch comments store actions', () => {
...
@@ -42,7 +42,7 @@ describe('Batch comments store actions', () => {
);
);
});
});
it
(
'
does not commit ADD_NEW_DRAFT if errors returned
'
,
done
=>
{
it
(
'
does not commit ADD_NEW_DRAFT if errors returned
'
,
(
done
)
=>
{
mock
.
onAny
().
reply
(
500
);
mock
.
onAny
().
reply
(
500
);
testAction
(
testAction
(
...
@@ -57,7 +57,7 @@ describe('Batch comments store actions', () => {
...
@@ -57,7 +57,7 @@ describe('Batch comments store actions', () => {
});
});
describe
(
'
createNewDraft
'
,
()
=>
{
describe
(
'
createNewDraft
'
,
()
=>
{
it
(
'
commits ADD_NEW_DRAFT if no errors returned
'
,
done
=>
{
it
(
'
commits ADD_NEW_DRAFT if no errors returned
'
,
(
done
)
=>
{
res
=
{
id
:
1
};
res
=
{
id
:
1
};
mock
.
onAny
().
reply
(
200
,
res
);
mock
.
onAny
().
reply
(
200
,
res
);
...
@@ -71,7 +71,7 @@ describe('Batch comments store actions', () => {
...
@@ -71,7 +71,7 @@ describe('Batch comments store actions', () => {
);
);
});
});
it
(
'
does not commit ADD_NEW_DRAFT if errors returned
'
,
done
=>
{
it
(
'
does not commit ADD_NEW_DRAFT if errors returned
'
,
(
done
)
=>
{
mock
.
onAny
().
reply
(
500
);
mock
.
onAny
().
reply
(
500
);
testAction
(
actions
.
createNewDraft
,
{
endpoint
:
TEST_HOST
,
data
:
'
test
'
},
null
,
[],
[],
done
);
testAction
(
actions
.
createNewDraft
,
{
endpoint
:
TEST_HOST
,
data
:
'
test
'
},
null
,
[],
[],
done
);
...
@@ -89,7 +89,7 @@ describe('Batch comments store actions', () => {
...
@@ -89,7 +89,7 @@ describe('Batch comments store actions', () => {
};
};
});
});
it
(
'
commits DELETE_DRAFT if no errors returned
'
,
done
=>
{
it
(
'
commits DELETE_DRAFT if no errors returned
'
,
(
done
)
=>
{
const
commit
=
jest
.
fn
();
const
commit
=
jest
.
fn
();
const
context
=
{
const
context
=
{
getters
,
getters
,
...
@@ -107,7 +107,7 @@ describe('Batch comments store actions', () => {
...
@@ -107,7 +107,7 @@ describe('Batch comments store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
does not commit DELETE_DRAFT if errors returned
'
,
done
=>
{
it
(
'
does not commit DELETE_DRAFT if errors returned
'
,
(
done
)
=>
{
const
commit
=
jest
.
fn
();
const
commit
=
jest
.
fn
();
const
context
=
{
const
context
=
{
getters
,
getters
,
...
@@ -136,7 +136,7 @@ describe('Batch comments store actions', () => {
...
@@ -136,7 +136,7 @@ describe('Batch comments store actions', () => {
};
};
});
});
it
(
'
commits SET_BATCH_COMMENTS_DRAFTS with returned data
'
,
done
=>
{
it
(
'
commits SET_BATCH_COMMENTS_DRAFTS with returned data
'
,
(
done
)
=>
{
const
commit
=
jest
.
fn
();
const
commit
=
jest
.
fn
();
const
context
=
{
const
context
=
{
getters
,
getters
,
...
@@ -170,7 +170,7 @@ describe('Batch comments store actions', () => {
...
@@ -170,7 +170,7 @@ describe('Batch comments store actions', () => {
rootGetters
=
{
discussionsStructuredByLineCode
:
'
discussions
'
};
rootGetters
=
{
discussionsStructuredByLineCode
:
'
discussions
'
};
});
});
it
(
'
dispatches actions & commits
'
,
done
=>
{
it
(
'
dispatches actions & commits
'
,
(
done
)
=>
{
mock
.
onAny
().
reply
(
200
);
mock
.
onAny
().
reply
(
200
);
actions
actions
...
@@ -185,7 +185,7 @@ describe('Batch comments store actions', () => {
...
@@ -185,7 +185,7 @@ describe('Batch comments store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
dispatches error commits
'
,
done
=>
{
it
(
'
dispatches error commits
'
,
(
done
)
=>
{
mock
.
onAny
().
reply
(
500
);
mock
.
onAny
().
reply
(
500
);
actions
actions
...
@@ -210,7 +210,7 @@ describe('Batch comments store actions', () => {
...
@@ -210,7 +210,7 @@ describe('Batch comments store actions', () => {
};
};
});
});
it
(
'
commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data
'
,
done
=>
{
it
(
'
commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data
'
,
(
done
)
=>
{
const
commit
=
jest
.
fn
();
const
commit
=
jest
.
fn
();
const
context
=
{
const
context
=
{
getters
,
getters
,
...
@@ -228,7 +228,7 @@ describe('Batch comments store actions', () => {
...
@@ -228,7 +228,7 @@ describe('Batch comments store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
calls passed callback
'
,
done
=>
{
it
(
'
calls passed callback
'
,
(
done
)
=>
{
const
commit
=
jest
.
fn
();
const
commit
=
jest
.
fn
();
const
context
=
{
const
context
=
{
getters
,
getters
,
...
@@ -249,7 +249,7 @@ describe('Batch comments store actions', () => {
...
@@ -249,7 +249,7 @@ describe('Batch comments store actions', () => {
});
});
describe
(
'
expandAllDiscussions
'
,
()
=>
{
describe
(
'
expandAllDiscussions
'
,
()
=>
{
it
(
'
dispatches expandDiscussion for all drafts
'
,
done
=>
{
it
(
'
dispatches expandDiscussion for all drafts
'
,
(
done
)
=>
{
const
state
=
{
const
state
=
{
drafts
:
[
drafts
:
[
{
{
...
...
spec/frontend/behaviors/autosize_spec.js
View file @
e3aca8c8
...
@@ -6,7 +6,7 @@ function load() {
...
@@ -6,7 +6,7 @@ function load() {
jest
.
mock
(
'
~/helpers/startup_css_helper
'
,
()
=>
{
jest
.
mock
(
'
~/helpers/startup_css_helper
'
,
()
=>
{
return
{
return
{
waitForCSSLoaded
:
jest
.
fn
().
mockImplementation
(
cb
=>
cb
.
apply
()),
waitForCSSLoaded
:
jest
.
fn
().
mockImplementation
(
(
cb
)
=>
cb
.
apply
()),
};
};
});
});
...
...
spec/frontend/behaviors/copy_as_gfm_spec.js
View file @
e3aca8c8
...
@@ -57,7 +57,7 @@ describe('CopyAsGFM', () => {
...
@@ -57,7 +57,7 @@ describe('CopyAsGFM', () => {
const
fragment
=
document
.
createDocumentFragment
();
const
fragment
=
document
.
createDocumentFragment
();
const
node
=
document
.
createElement
(
'
div
'
);
const
node
=
document
.
createElement
(
'
div
'
);
node
.
innerHTML
=
html
;
node
.
innerHTML
=
html
;
Array
.
from
(
node
.
childNodes
).
forEach
(
item
=>
fragment
.
appendChild
(
item
));
Array
.
from
(
node
.
childNodes
).
forEach
(
(
item
)
=>
fragment
.
appendChild
(
item
));
return
fragment
;
return
fragment
;
},
},
}),
}),
...
@@ -80,7 +80,7 @@ describe('CopyAsGFM', () => {
...
@@ -80,7 +80,7 @@ describe('CopyAsGFM', () => {
return
clipboardData
;
return
clipboardData
;
};
};
beforeAll
(
done
=>
{
beforeAll
(
(
done
)
=>
{
initCopyAsGFM
();
initCopyAsGFM
();
// Fake call to nodeToGfm so the import of lazy bundle happened
// Fake call to nodeToGfm so the import of lazy bundle happened
...
@@ -94,7 +94,7 @@ describe('CopyAsGFM', () => {
...
@@ -94,7 +94,7 @@ describe('CopyAsGFM', () => {
beforeEach
(()
=>
jest
.
spyOn
(
clipboardData
,
'
setData
'
));
beforeEach
(()
=>
jest
.
spyOn
(
clipboardData
,
'
setData
'
));
describe
(
'
list handling
'
,
()
=>
{
describe
(
'
list handling
'
,
()
=>
{
it
(
'
uses correct gfm for unordered lists
'
,
done
=>
{
it
(
'
uses correct gfm for unordered lists
'
,
(
done
)
=>
{
const
selection
=
stubSelection
(
'
<li>List Item1</li><li>List Item2</li>
\n
'
,
'
UL
'
);
const
selection
=
stubSelection
(
'
<li>List Item1</li><li>List Item2</li>
\n
'
,
'
UL
'
);
window
.
getSelection
=
jest
.
fn
(()
=>
selection
);
window
.
getSelection
=
jest
.
fn
(()
=>
selection
);
...
@@ -108,7 +108,7 @@ describe('CopyAsGFM', () => {
...
@@ -108,7 +108,7 @@ describe('CopyAsGFM', () => {
});
});
});
});
it
(
'
uses correct gfm for ordered lists
'
,
done
=>
{
it
(
'
uses correct gfm for ordered lists
'
,
(
done
)
=>
{
const
selection
=
stubSelection
(
'
<li>List Item1</li><li>List Item2</li>
\n
'
,
'
OL
'
);
const
selection
=
stubSelection
(
'
<li>List Item1</li><li>List Item2</li>
\n
'
,
'
OL
'
);
window
.
getSelection
=
jest
.
fn
(()
=>
selection
);
window
.
getSelection
=
jest
.
fn
(()
=>
selection
);
...
@@ -127,7 +127,7 @@ describe('CopyAsGFM', () => {
...
@@ -127,7 +127,7 @@ describe('CopyAsGFM', () => {
describe
(
'
CopyAsGFM.quoted
'
,
()
=>
{
describe
(
'
CopyAsGFM.quoted
'
,
()
=>
{
const
sampleGFM
=
'
* List 1
\n
* List 2
\n\n
`Some code`
'
;
const
sampleGFM
=
'
* List 1
\n
* List 2
\n\n
`Some code`
'
;
it
(
'
adds quote char `> ` to each line
'
,
done
=>
{
it
(
'
adds quote char `> ` to each line
'
,
(
done
)
=>
{
const
expectedQuotedGFM
=
'
> * List 1
\n
> * List 2
\n
>
\n
> `Some code`
'
;
const
expectedQuotedGFM
=
'
> * List 1
\n
> * List 2
\n
>
\n
> `Some code`
'
;
expect
(
CopyAsGFM
.
quoted
(
sampleGFM
)).
toEqual
(
expectedQuotedGFM
);
expect
(
CopyAsGFM
.
quoted
(
sampleGFM
)).
toEqual
(
expectedQuotedGFM
);
done
();
done
();
...
...
spec/frontend/behaviors/load_startup_css_spec.js
View file @
e3aca8c8
...
@@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => {
...
@@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => {
const
setupListeners
=
()
=>
{
const
setupListeners
=
()
=>
{
document
document
.
querySelectorAll
(
'
link
'
)
.
querySelectorAll
(
'
link
'
)
.
forEach
(
x
=>
x
.
addEventListener
(
'
load
'
,
()
=>
loadListener
(
x
)));
.
forEach
(
(
x
)
=>
x
.
addEventListener
(
'
load
'
,
()
=>
loadListener
(
x
)));
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
...
spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
View file @
e3aca8c8
...
@@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => {
...
@@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => {
Object
.
defineProperty
(
event
,
'
dataTransfer
'
,
{
Object
.
defineProperty
(
event
,
'
dataTransfer
'
,
{
value
:
{
value
:
{
getData
:
jest
.
fn
().
mockImplementation
(
type
=>
{
getData
:
jest
.
fn
().
mockImplementation
(
(
type
)
=>
{
if
(
type
===
'
text/html
'
)
{
if
(
type
===
'
text/html
'
)
{
return
'
<table><tr><td>First</td><td>Second</td></tr></table>
'
;
return
'
<table><tr><td>First</td><td>Second</td></tr></table>
'
;
}
}
...
@@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => {
...
@@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => {
it
(
'
returns false when the number of rows are not consistent
'
,
()
=>
{
it
(
'
returns false when the number of rows are not consistent
'
,
()
=>
{
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
getData
=
jest
.
fn
().
mockImplementation
(
mimeType
=>
{
data
.
getData
=
jest
.
fn
().
mockImplementation
(
(
mimeType
)
=>
{
if
(
mimeType
===
'
text/html
'
)
{
if
(
mimeType
===
'
text/html
'
)
{
return
'
<table><tr><td>def test<td></tr></table>
'
;
return
'
<table><tr><td>def test<td></tr></table>
'
;
}
}
...
@@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => {
...
@@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => {
it
(
'
returns false when the table copy comes from a diff
'
,
()
=>
{
it
(
'
returns false when the table copy comes from a diff
'
,
()
=>
{
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
getData
=
jest
.
fn
().
mockImplementation
(
mimeType
=>
{
data
.
getData
=
jest
.
fn
().
mockImplementation
(
(
mimeType
)
=>
{
if
(
mimeType
===
'
text/html
'
)
{
if
(
mimeType
===
'
text/html
'
)
{
return
'
<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>
'
;
return
'
<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>
'
;
}
}
...
@@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => {
...
@@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => {
describe
(
'
convertToTableMarkdown
'
,
()
=>
{
describe
(
'
convertToTableMarkdown
'
,
()
=>
{
it
(
'
returns a Markdown table
'
,
()
=>
{
it
(
'
returns a Markdown table
'
,
()
=>
{
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
getData
=
jest
.
fn
().
mockImplementation
(
type
=>
{
data
.
getData
=
jest
.
fn
().
mockImplementation
(
(
type
)
=>
{
if
(
type
===
'
text/html
'
)
{
if
(
type
===
'
text/html
'
)
{
return
'
<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>
'
;
return
'
<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>
'
;
}
else
if
(
type
===
'
text/plain
'
)
{
}
else
if
(
type
===
'
text/plain
'
)
{
...
@@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => {
...
@@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => {
it
(
'
returns a Markdown table with rows normalized
'
,
()
=>
{
it
(
'
returns a Markdown table with rows normalized
'
,
()
=>
{
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
types
=
[
'
text/html
'
,
'
text/plain
'
];
data
.
getData
=
jest
.
fn
().
mockImplementation
(
type
=>
{
data
.
getData
=
jest
.
fn
().
mockImplementation
(
(
type
)
=>
{
if
(
type
===
'
text/html
'
)
{
if
(
type
===
'
text/html
'
)
{
return
'
<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>
'
;
return
'
<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>
'
;
}
else
if
(
type
===
'
text/plain
'
)
{
}
else
if
(
type
===
'
text/plain
'
)
{
...
...
spec/frontend/behaviors/quick_submit_spec.js
View file @
e3aca8c8
...
@@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => {
...
@@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => {
submit
:
jest
.
fn
(),
submit
:
jest
.
fn
(),
};
};
$
(
'
form
'
).
submit
(
e
=>
{
$
(
'
form
'
).
submit
(
(
e
)
=>
{
// Prevent a form submit from moving us off the testing page
// Prevent a form submit from moving us off the testing page
e
.
preventDefault
();
e
.
preventDefault
();
// Explicitly call the spie to know this function get's not called
// Explicitly call the spie to know this function get's not called
...
...
spec/frontend/behaviors/secret_values_spec.js
View file @
e3aca8c8
...
@@ -18,7 +18,7 @@ function generateValueMarkup(
...
@@ -18,7 +18,7 @@ function generateValueMarkup(
function
generateFixtureMarkup
(
secrets
,
isRevealed
,
valueClass
,
placeholderClass
)
{
function
generateFixtureMarkup
(
secrets
,
isRevealed
,
valueClass
,
placeholderClass
)
{
return
`
return
`
<div class="js-secret-container">
<div class="js-secret-container">
${
secrets
.
map
(
secret
=>
generateValueMarkup
(
secret
,
valueClass
,
placeholderClass
)).
join
(
''
)}
${
secrets
.
map
(
(
secret
)
=>
generateValueMarkup
(
secret
,
valueClass
,
placeholderClass
)).
join
(
''
)}
<button
<button
class="js-secret-value-reveal-button"
class="js-secret-value-reveal-button"
data-secret-reveal-status="
${
isRevealed
}
"
data-secret-reveal-status="
${
isRevealed
}
"
...
@@ -122,12 +122,12 @@ describe('setupSecretValues', () => {
...
@@ -122,12 +122,12 @@ describe('setupSecretValues', () => {
const
placeholders
=
wrapper
.
querySelectorAll
(
'
.js-secret-value-placeholder
'
);
const
placeholders
=
wrapper
.
querySelectorAll
(
'
.js-secret-value-placeholder
'
);
expect
(
values
.
length
).
toEqual
(
3
);
expect
(
values
.
length
).
toEqual
(
3
);
values
.
forEach
(
value
=>
{
values
.
forEach
(
(
value
)
=>
{
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
});
});
expect
(
placeholders
.
length
).
toEqual
(
3
);
expect
(
placeholders
.
length
).
toEqual
(
3
);
placeholders
.
forEach
(
placeholder
=>
{
placeholders
.
forEach
(
(
placeholder
)
=>
{
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
});
});
});
});
...
@@ -141,24 +141,24 @@ describe('setupSecretValues', () => {
...
@@ -141,24 +141,24 @@ describe('setupSecretValues', () => {
revealButton
.
click
();
revealButton
.
click
();
expect
(
values
.
length
).
toEqual
(
3
);
expect
(
values
.
length
).
toEqual
(
3
);
values
.
forEach
(
value
=>
{
values
.
forEach
(
(
value
)
=>
{
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
});
});
expect
(
placeholders
.
length
).
toEqual
(
3
);
expect
(
placeholders
.
length
).
toEqual
(
3
);
placeholders
.
forEach
(
placeholder
=>
{
placeholders
.
forEach
(
(
placeholder
)
=>
{
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
});
});
revealButton
.
click
();
revealButton
.
click
();
expect
(
values
.
length
).
toEqual
(
3
);
expect
(
values
.
length
).
toEqual
(
3
);
values
.
forEach
(
value
=>
{
values
.
forEach
(
(
value
)
=>
{
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
});
});
expect
(
placeholders
.
length
).
toEqual
(
3
);
expect
(
placeholders
.
length
).
toEqual
(
3
);
placeholders
.
forEach
(
placeholder
=>
{
placeholders
.
forEach
(
(
placeholder
)
=>
{
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
});
});
});
});
...
@@ -181,24 +181,24 @@ describe('setupSecretValues', () => {
...
@@ -181,24 +181,24 @@ describe('setupSecretValues', () => {
revealButton
.
click
();
revealButton
.
click
();
expect
(
values
.
length
).
toEqual
(
4
);
expect
(
values
.
length
).
toEqual
(
4
);
values
.
forEach
(
value
=>
{
values
.
forEach
(
(
value
)
=>
{
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
});
});
expect
(
placeholders
.
length
).
toEqual
(
4
);
expect
(
placeholders
.
length
).
toEqual
(
4
);
placeholders
.
forEach
(
placeholder
=>
{
placeholders
.
forEach
(
(
placeholder
)
=>
{
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
});
});
revealButton
.
click
();
revealButton
.
click
();
expect
(
values
.
length
).
toEqual
(
4
);
expect
(
values
.
length
).
toEqual
(
4
);
values
.
forEach
(
value
=>
{
values
.
forEach
(
(
value
)
=>
{
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
expect
(
value
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
true
);
});
});
expect
(
placeholders
.
length
).
toEqual
(
4
);
expect
(
placeholders
.
length
).
toEqual
(
4
);
placeholders
.
forEach
(
placeholder
=>
{
placeholders
.
forEach
(
(
placeholder
)
=>
{
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
expect
(
placeholder
.
classList
.
contains
(
'
hide
'
)).
toEqual
(
false
);
});
});
});
});
...
...
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