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
fd12733f
Commit
fd12733f
authored
Mar 12, 2020
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate ee/issues_analytics to Jest
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/194292
parent
c943774f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
24 deletions
+12
-24
ee/spec/frontend/issues_analytics/stores/modules/issues_analytics/actions_spec.js
...analytics/stores/modules/issues_analytics/actions_spec.js
+12
-24
No files found.
ee/spec/
javascripts
/issues_analytics/stores/modules/issues_analytics/actions_spec.js
→
ee/spec/
frontend
/issues_analytics/stores/modules/issues_analytics/actions_spec.js
View file @
fd12733f
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
testAction
from
'
spec/
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
*
as
actions
from
'
ee/issues_analytics/stores/modules/issue_analytics/actions
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
describe
(
'
Issue analytics store actions
'
,
()
=>
{
describe
(
'
setFilters
'
,
()
=>
{
it
(
'
commits SET_FILTERS
'
,
done
=>
{
testAction
(
actions
.
setFilters
,
null
,
null
,
[{
type
:
'
SET_FILTERS
'
,
payload
:
null
}],
[],
done
,
);
it
(
'
commits SET_FILTERS
'
,
()
=>
{
testAction
(
actions
.
setFilters
,
null
,
null
,
[{
type
:
'
SET_FILTERS
'
,
payload
:
null
}],
[]);
});
});
describe
(
'
setLoadingState
'
,
()
=>
{
it
(
'
commits SET_LOADING_STATE
'
,
done
=>
{
it
(
'
commits SET_LOADING_STATE
'
,
()
=>
{
testAction
(
actions
.
setLoadingState
,
true
,
null
,
[{
type
:
'
SET_LOADING_STATE
'
,
payload
:
true
}],
[],
done
,
);
});
});
...
...
@@ -37,8 +29,8 @@ describe('Issue analytics store actions', () => {
const
chartData
=
{
'
2017-11
'
:
0
,
'
2017-12
'
:
2
};
beforeEach
(()
=>
{
dispatch
=
j
asmine
.
createSpy
(
'
dispatch
'
);
commit
=
j
asmine
.
createSpy
(
'
commit
'
);
dispatch
=
j
est
.
fn
().
mockName
(
'
dispatch
'
);
commit
=
j
est
.
fn
().
mockName
(
'
commit
'
);
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
().
reply
(
200
,
chartData
);
...
...
@@ -48,7 +40,7 @@ describe('Issue analytics store actions', () => {
mock
.
restore
();
});
it
(
'
commits SET_CHART_DATA with chart data
'
,
done
=>
{
it
(
'
commits SET_CHART_DATA with chart data
'
,
()
=>
{
const
getters
=
{
appliedFilters
:
'
?hello=world
'
};
const
context
=
{
dispatch
,
...
...
@@ -56,15 +48,11 @@ describe('Issue analytics store actions', () => {
commit
,
};
actions
.
fetchChartData
(
context
,
gl
.
TEST_HOST
)
.
then
(()
=>
{
expect
(
dispatch
.
calls
.
argsFor
(
0
)).
toEqual
([
'
setLoadingState
'
,
true
]);
return
actions
.
fetchChartData
(
context
,
gl
.
TEST_HOST
).
then
(()
=>
{
expect
(
dispatch
.
mock
.
calls
[
0
]).
toEqual
([
'
setLoadingState
'
,
true
]);
expect
(
commit
).
toHaveBeenCalledWith
(
'
SET_CHART_DATA
'
,
chartData
);
expect
(
dispatch
.
calls
.
argsFor
(
1
)).
toEqual
([
'
setLoadingState
'
,
false
]);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
expect
(
dispatch
.
mock
.
calls
[
1
]).
toEqual
([
'
setLoadingState
'
,
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