Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-12 12:08:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-12 12:08:57 +0300
commit1fdf76252e8fdf1a30826fe3f32a6216e50c563c (patch)
tree949a5db75031f54dafa48b31a89546bbff8182f3 /spec/frontend/boards/stores/actions_spec.js
parent5f362c717e637ba18d04d2ed6722098455c8b571 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/stores/actions_spec.js')
-rw-r--r--spec/frontend/boards/stores/actions_spec.js55
1 files changed, 39 insertions, 16 deletions
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js
index e6985f6c984..f5eb0cb8474 100644
--- a/spec/frontend/boards/stores/actions_spec.js
+++ b/spec/frontend/boards/stores/actions_spec.js
@@ -674,40 +674,63 @@ describe('setAssignees', () => {
});
describe('createNewIssue', () => {
- expectNotImplemented(actions.createNewIssue);
-});
+ const state = {
+ boardType: 'group',
+ endpoints: {
+ fullPath: 'gitlab-org/gitlab',
+ },
+ };
-describe('addListIssue', () => {
- it('should commit UPDATE_LIST_FAILURE mutation when API returns an error', done => {
- const payload = {
- list: mockLists[0],
- issue: mockIssue,
- position: 0,
- };
+ it('should return issue from API on success', async () => {
+ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
+ data: {
+ createIssue: {
+ issue: mockIssue,
+ errors: [],
+ },
+ },
+ });
+
+ const result = await actions.createNewIssue({ state }, mockIssue);
+ expect(result).toEqual(mockIssue);
+ });
+
+ it('should commit CREATE_ISSUE_FAILURE mutation when API returns an error', done => {
+ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
+ data: {
+ createIssue: {
+ issue: {},
+ errors: [{ foo: 'bar' }],
+ },
+ },
+ });
+
+ const payload = mockIssue;
testAction(
- actions.addListIssue,
+ actions.createNewIssue,
payload,
- {},
- [{ type: types.ADD_ISSUE_TO_LIST, payload }],
+ state,
+ [{ type: types.CREATE_ISSUE_FAILURE }],
[],
done,
);
});
});
-describe('addListIssueFailure', () => {
- it('should commit UPDATE_LIST_FAILURE mutation when API returns an error', done => {
+describe('addListIssue', () => {
+ it('should commit ADD_ISSUE_TO_LIST mutation', done => {
const payload = {
list: mockLists[0],
issue: mockIssue,
+ position: 0,
};
testAction(
- actions.addListIssueFailure,
+ actions.addListIssue,
payload,
{},
- [{ type: types.ADD_ISSUE_TO_LIST_FAILURE, payload }],
+ [{ type: types.ADD_ISSUE_TO_LIST, payload }],
[],
done,
);