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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
f8d8b63f
Commit
f8d8b63f
authored
Jun 05, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed karma
parent
d644798f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
21 deletions
+68
-21
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
.../javascripts/ide/stores/modules/merge_requests/actions.js
+2
-3
spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
...scripts/ide/stores/modules/merge_requests/actions_spec.js
+66
-18
No files found.
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
View file @
f8d8b63f
...
...
@@ -34,10 +34,9 @@ export const openMergeRequest = ({ commit, dispatch }, { projectPath, id }) => {
dispatch
(
'
pipelines/stopPipelinePolling
'
,
null
,
{
root
:
true
});
dispatch
(
'
pipelines/clearEtagPoll
'
,
null
,
{
root
:
true
});
dispatch
(
'
pipelines/resetLatestPipeline
'
,
null
,
{
root
:
true
});
dispatch
(
'
setCurrentBranchId
'
,
''
,
{
root
:
true
});
return
dispatch
(
'
setCurrentBranchId
'
,
''
,
{
root
:
true
}).
then
(()
=>
router
.
push
(
`/project/
${
projectPath
}
/merge_requests/
${
id
}
`
),
);
router
.
push
(
`/project/
${
projectPath
}
/merge_requests/
${
id
}
`
);
};
export
default
()
=>
{};
spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
View file @
f8d8b63f
...
...
@@ -8,7 +8,9 @@ import actions, {
receiveMergeRequestsSuccess
,
fetchMergeRequests
,
resetMergeRequests
,
openMergeRequest
,
}
from
'
~/ide/stores/modules/merge_requests/actions
'
;
import
router
from
'
~/ide/ide_router
'
;
import
{
mergeRequests
}
from
'
../../../mock_data
'
;
import
testAction
from
'
../../../../helpers/vuex_action_helper
'
;
...
...
@@ -29,9 +31,9 @@ describe('IDE merge requests actions', () => {
it
(
'
should should commit request
'
,
done
=>
{
testAction
(
requestMergeRequests
,
null
,
'
created
'
,
mockedState
,
[{
type
:
types
.
REQUEST_MERGE_REQUESTS
}],
[{
type
:
types
.
REQUEST_MERGE_REQUESTS
,
payload
:
'
created
'
}],
[],
done
,
);
...
...
@@ -48,16 +50,16 @@ describe('IDE merge requests actions', () => {
it
(
'
should should commit error
'
,
done
=>
{
testAction
(
receiveMergeRequestsError
,
null
,
'
created
'
,
mockedState
,
[{
type
:
types
.
RECEIVE_MERGE_REQUESTS_ERROR
}],
[{
type
:
types
.
RECEIVE_MERGE_REQUESTS_ERROR
,
payload
:
'
created
'
}],
[],
done
,
);
});
it
(
'
creates flash message
'
,
()
=>
{
receiveMergeRequestsError
({
commit
()
{}
});
receiveMergeRequestsError
({
commit
()
{}
}
,
'
created
'
);
expect
(
flashSpy
).
toHaveBeenCalled
();
});
...
...
@@ -67,9 +69,14 @@ describe('IDE merge requests actions', () => {
it
(
'
should commit received data
'
,
done
=>
{
testAction
(
receiveMergeRequestsSuccess
,
'
data
'
,
{
type
:
'
created
'
,
data
:
'
data
'
}
,
mockedState
,
[{
type
:
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
,
payload
:
'
data
'
}],
[
{
type
:
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
,
payload
:
{
type
:
'
created
'
,
data
:
'
data
'
},
},
],
[],
done
,
);
...
...
@@ -86,14 +93,14 @@ describe('IDE merge requests actions', () => {
mock
.
onGet
(
/
\/
api
\/
v4
\/
merge_requests
(
.*
)
$/
).
replyOnce
(
200
,
mergeRequests
);
});
it
(
'
calls API with params
from state
'
,
()
=>
{
it
(
'
calls API with params
'
,
()
=>
{
const
apiSpy
=
spyOn
(
axios
,
'
get
'
).
and
.
callThrough
();
fetchMergeRequests
({
dispatch
()
{},
state
:
mockedState
});
fetchMergeRequests
({
dispatch
()
{},
state
:
mockedState
}
,
{
type
:
'
created
'
}
);
expect
(
apiSpy
).
toHaveBeenCalledWith
(
jasmine
.
anything
(),
{
params
:
{
scope
:
'
assigned-to
-me
'
,
scope
:
'
created-by
-me
'
,
state
:
'
opened
'
,
search
:
''
,
},
...
...
@@ -103,11 +110,14 @@ describe('IDE merge requests actions', () => {
it
(
'
calls API with search
'
,
()
=>
{
const
apiSpy
=
spyOn
(
axios
,
'
get
'
).
and
.
callThrough
();
fetchMergeRequests
({
dispatch
()
{},
state
:
mockedState
},
'
testing search
'
);
fetchMergeRequests
(
{
dispatch
()
{},
state
:
mockedState
},
{
type
:
'
created
'
,
search
:
'
testing search
'
},
);
expect
(
apiSpy
).
toHaveBeenCalledWith
(
jasmine
.
anything
(),
{
params
:
{
scope
:
'
assigned-to
-me
'
,
scope
:
'
created-by
-me
'
,
state
:
'
opened
'
,
search
:
'
testing search
'
,
},
...
...
@@ -117,7 +127,7 @@ describe('IDE merge requests actions', () => {
it
(
'
dispatches request
'
,
done
=>
{
testAction
(
fetchMergeRequests
,
null
,
{
type
:
'
created
'
}
,
mockedState
,
[],
[
...
...
@@ -132,13 +142,16 @@ describe('IDE merge requests actions', () => {
it
(
'
dispatches success with received data
'
,
done
=>
{
testAction
(
fetchMergeRequests
,
null
,
{
type
:
'
created
'
}
,
mockedState
,
[],
[
{
type
:
'
requestMergeRequests
'
},
{
type
:
'
resetMergeRequests
'
},
{
type
:
'
receiveMergeRequestsSuccess
'
,
payload
:
mergeRequests
},
{
type
:
'
receiveMergeRequestsSuccess
'
,
payload
:
{
type
:
'
created
'
,
data
:
mergeRequests
},
},
],
done
,
);
...
...
@@ -153,7 +166,7 @@ describe('IDE merge requests actions', () => {
it
(
'
dispatches error
'
,
done
=>
{
testAction
(
fetchMergeRequests
,
null
,
{
type
:
'
created
'
}
,
mockedState
,
[],
[
...
...
@@ -171,12 +184,47 @@ describe('IDE merge requests actions', () => {
it
(
'
commits reset
'
,
done
=>
{
testAction
(
resetMergeRequests
,
null
,
'
created
'
,
mockedState
,
[{
type
:
types
.
RESET_MERGE_REQUESTS
}],
[{
type
:
types
.
RESET_MERGE_REQUESTS
,
payload
:
'
created
'
}],
[],
done
,
);
});
});
describe
(
'
openMergeRequest
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
router
,
'
push
'
);
});
it
(
'
commits reset mutations and actions
'
,
done
=>
{
testAction
(
openMergeRequest
,
{
projectPath
:
'
gitlab-org/gitlab-ce
'
,
id
:
'
1
'
},
mockedState
,
[
{
type
:
'
CLEAR_PROJECTS
'
},
{
type
:
'
SET_CURRENT_MERGE_REQUEST
'
,
payload
:
'
1
'
},
{
type
:
'
RESET_OPEN_FILES
'
},
],
[
{
type
:
'
pipelines/stopPipelinePolling
'
},
{
type
:
'
pipelines/clearEtagPoll
'
},
{
type
:
'
pipelines/resetLatestPipeline
'
},
{
type
:
'
setCurrentBranchId
'
,
payload
:
''
},
],
done
,
);
});
it
(
'
pushes new route
'
,
()
=>
{
openMergeRequest
(
{
commit
()
{},
dispatch
()
{}
},
{
projectPath
:
'
gitlab-org/gitlab-ce
'
,
id
:
'
1
'
},
);
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/gitlab-org/gitlab-ce/merge_requests/1
'
);
});
});
});
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