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
422219de
Commit
422219de
authored
Mar 08, 2020
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken jest specs
parent
ffa2b3a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
77 deletions
+3
-77
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
.../frontend/analytics/cycle_analytics/store/actions_spec.js
+3
-77
No files found.
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
422219de
...
...
@@ -42,18 +42,8 @@ describe('Cycle analytics actions', () => {
let
state
;
let
mock
;
function
shouldSetUrlParams
({
action
,
payload
,
result
})
{
const
store
=
{
state
,
getters
,
commit
:
jest
.
fn
(),
dispatch
:
jest
.
fn
(()
=>
Promise
.
resolve
()),
};
return
actions
[
action
](
store
,
payload
).
then
(()
=>
{
expect
(
urlUtils
.
setUrlParams
).
toHaveBeenCalledWith
(
result
,
window
.
location
.
href
,
true
);
expect
(
commonUtils
.
historyPushState
).
toHaveBeenCalled
();
});
function
shouldFlashAMessage
(
msg
=
flashErrorMessage
)
{
expect
(
document
.
querySelector
(
'
.flash-container .flash-text
'
).
innerText
.
trim
()).
toBe
(
msg
);
}
beforeEach
(()
=>
{
...
...
@@ -99,61 +89,10 @@ describe('Cycle analytics actions', () => {
);
});
describe
(
'
setSelectedGroup
'
,
()
=>
{
const
payload
=
{
full_path
:
'
someNewGroup
'
};
it
(
'
calls setUrlParams with the group params
'
,
()
=>
{
actions
.
setSelectedGroup
(
{
state
,
getters
:
{
currentGroupPath
:
'
someNewGroup
'
,
selectedProjectIds
:
[],
},
commit
:
jest
.
fn
(),
},
payload
,
);
expect
(
urlUtils
.
setUrlParams
).
toHaveBeenCalledWith
(
{
group_id
:
'
someNewGroup
'
,
'
project_ids[]
'
:
[],
},
window
.
location
.
href
,
true
,
);
expect
(
commonUtils
.
historyPushState
).
toHaveBeenCalled
();
});
});
describe
(
'
setSelectedProjects
'
,
()
=>
{
const
payload
=
[
1
,
2
];
it
(
'
calls setUrlParams with the date params
'
,
()
=>
{
actions
.
setSelectedProjects
(
{
state
,
getters
:
{
currentGroupPath
:
'
test-group
'
,
selectedProjectIds
:
payload
,
},
commit
:
jest
.
fn
(),
},
payload
,
);
expect
(
urlUtils
.
setUrlParams
).
toHaveBeenCalledWith
(
{
'
project_ids[]
'
:
payload
,
group_id
:
'
test-group
'
},
window
.
location
.
href
,
true
,
);
expect
(
commonUtils
.
historyPushState
).
toHaveBeenCalled
();
});
});
describe
(
'
setDateRange
'
,
()
=>
{
const
payload
=
{
startDate
,
endDate
};
it
(
'
sets the dates as expected and dispatches fetchCycleAnalyticsData
'
,
done
=>
{
it
(
'
dispatches the fetchCycleAnalyticsData action
'
,
done
=>
{
testAction
(
actions
.
setDateRange
,
payload
,
...
...
@@ -163,19 +102,6 @@ describe('Cycle analytics actions', () => {
done
,
);
});
it
(
'
calls setUrlParams with the date params
'
,
()
=>
{
shouldSetUrlParams
({
action
:
'
setDateRange
'
,
payload
,
result
:
{
group_id
:
getters
.
currentGroupPath
,
'
project_ids[]
'
:
getters
.
selectedProjectIds
,
created_after
:
toYmd
(
payload
.
startDate
),
created_before
:
toYmd
(
payload
.
endDate
),
},
});
});
});
describe
(
'
fetchStageData
'
,
()
=>
{
...
...
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