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
fa3a2166
Commit
fa3a2166
authored
Dec 05, 2019
by
Marvin Karegyeya
Committed by
Natalia Tepluhina
Dec 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete board_service.js file
parent
fdabd907
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
141 deletions
+41
-141
app/assets/javascripts/boards/services/board_service.js
app/assets/javascripts/boards/services/board_service.js
+0
-98
changelogs/unreleased/Delete-board_service-js-in-app-folder.yml
...logs/unreleased/Delete-board_service-js-in-app-folder.yml
+5
-0
ee/spec/javascripts/boards/components/assignee_select_spec.js
...pec/javascripts/boards/components/assignee_select_spec.js
+0
-1
spec/frontend/boards/boards_store_spec.js
spec/frontend/boards/boards_store_spec.js
+36
-39
spec/javascripts/boards/boards_store_spec.js
spec/javascripts/boards/boards_store_spec.js
+0
-1
spec/javascripts/boards/issue_spec.js
spec/javascripts/boards/issue_spec.js
+0
-1
spec/javascripts/boards/list_spec.js
spec/javascripts/boards/list_spec.js
+0
-1
No files found.
app/assets/javascripts/boards/services/board_service.js
deleted
100644 → 0
View file @
fdabd907
/* eslint-disable class-methods-use-this */
/**
* This file is intended to be deleted.
* The existing functions will removed one by one in favor of using the board store directly.
* see https://gitlab.com/gitlab-org/gitlab-foss/issues/61621
*/
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
export
default
class
BoardService
{
generateBoardsPath
(
id
)
{
return
boardsStore
.
generateBoardsPath
(
id
);
}
generateIssuesPath
(
id
)
{
return
boardsStore
.
generateIssuesPath
(
id
);
}
static
generateIssuePath
(
boardId
,
id
)
{
return
boardsStore
.
generateIssuePath
(
boardId
,
id
);
}
all
()
{
return
boardsStore
.
all
();
}
generateDefaultLists
()
{
return
boardsStore
.
generateDefaultLists
();
}
createList
(
entityId
,
entityType
)
{
return
boardsStore
.
createList
(
entityId
,
entityType
);
}
updateList
(
id
,
position
,
collapsed
)
{
return
boardsStore
.
updateList
(
id
,
position
,
collapsed
);
}
destroyList
(
id
)
{
return
boardsStore
.
destroyList
(
id
);
}
getIssuesForList
(
id
,
filter
=
{})
{
return
boardsStore
.
getIssuesForList
(
id
,
filter
);
}
moveIssue
(
id
,
fromListId
=
null
,
toListId
=
null
,
moveBeforeId
=
null
,
moveAfterId
=
null
)
{
return
boardsStore
.
moveIssue
(
id
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
);
}
moveMultipleIssues
({
ids
,
fromListId
=
null
,
toListId
=
null
,
moveBeforeId
=
null
,
moveAfterId
=
null
,
})
{
return
boardsStore
.
moveMultipleIssues
({
ids
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
});
}
newIssue
(
id
,
issue
)
{
return
boardsStore
.
newIssue
(
id
,
issue
);
}
getBacklog
(
data
)
{
return
boardsStore
.
getBacklog
(
data
);
}
bulkUpdate
(
issueIds
,
extraData
=
{})
{
return
boardsStore
.
bulkUpdate
(
issueIds
,
extraData
);
}
static
getIssueInfo
(
endpoint
)
{
return
boardsStore
.
getIssueInfo
(
endpoint
);
}
static
toggleIssueSubscription
(
endpoint
)
{
return
boardsStore
.
toggleIssueSubscription
(
endpoint
);
}
allBoards
()
{
return
boardsStore
.
allBoards
();
}
recentBoards
()
{
return
boardsStore
.
recentBoards
();
}
createBoard
(
board
)
{
return
boardsStore
.
createBoard
(
board
);
}
deleteBoard
({
id
})
{
return
boardsStore
.
deleteBoard
({
id
});
}
}
window
.
BoardService
=
BoardService
;
changelogs/unreleased/Delete-board_service-js-in-app-folder.yml
0 → 100644
View file @
fa3a2166
---
title
:
delete board_service.js
merge_request
:
20168
author
:
nuwe1
type
:
other
ee/spec/javascripts/boards/components/assignee_select_spec.js
View file @
fa3a2166
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
IssuableContext
from
'
~/issuable_context
'
;
import
IssuableContext
from
'
~/issuable_context
'
;
import
AssigneeSelect
from
'
ee/boards/components/assignee_select.vue
'
;
import
AssigneeSelect
from
'
ee/boards/components/assignee_select.vue
'
;
...
...
spec/frontend/boards/
services/board_servic
e_spec.js
→
spec/frontend/boards/
boards_stor
e_spec.js
View file @
fa3a2166
import
BoardService
from
'
~/boards/services/board_service
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
describe
(
'
BoardServic
e
'
,
()
=>
{
describe
(
'
boardsStor
e
'
,
()
=>
{
const
dummyResponse
=
"
without type checking this doesn't matter
"
;
const
dummyResponse
=
"
without type checking this doesn't matter
"
;
const
boardId
=
'
dummy-board-id
'
;
const
boardId
=
'
dummy-board-id
'
;
const
endpoints
=
{
const
endpoints
=
{
...
@@ -14,7 +13,6 @@ describe('BoardService', () => {
...
@@ -14,7 +13,6 @@ describe('BoardService', () => {
recentBoardsEndpoint
:
`
${
TEST_HOST
}
/recent/boards`
,
recentBoardsEndpoint
:
`
${
TEST_HOST
}
/recent/boards`
,
};
};
let
service
;
let
axiosMock
;
let
axiosMock
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -23,7 +21,6 @@ describe('BoardService', () => {
...
@@ -23,7 +21,6 @@ describe('BoardService', () => {
...
endpoints
,
...
endpoints
,
boardId
,
boardId
,
});
});
service
=
new
BoardService
();
});
});
describe
(
'
all
'
,
()
=>
{
describe
(
'
all
'
,
()
=>
{
...
@@ -31,13 +28,13 @@ describe('BoardService', () => {
...
@@ -31,13 +28,13 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
endpoints
.
listsEndpoint
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
endpoints
.
listsEndpoint
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
all
()).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
all
()).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onGet
(
endpoints
.
listsEndpoint
).
replyOnce
(
500
);
axiosMock
.
onGet
(
endpoints
.
listsEndpoint
).
replyOnce
(
500
);
return
expect
(
servic
e
.
all
()).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
all
()).
rejects
.
toThrow
();
});
});
});
});
...
@@ -48,13 +45,13 @@ describe('BoardService', () => {
...
@@ -48,13 +45,13 @@ describe('BoardService', () => {
axiosMock
.
onPost
(
listsEndpointGenerate
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onPost
(
listsEndpointGenerate
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
generateDefaultLists
()).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
generateDefaultLists
()).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onPost
(
listsEndpointGenerate
).
replyOnce
(
500
);
axiosMock
.
onPost
(
listsEndpointGenerate
).
replyOnce
(
500
);
return
expect
(
servic
e
.
generateDefaultLists
()).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
generateDefaultLists
()).
rejects
.
toThrow
();
});
});
});
});
...
@@ -76,7 +73,7 @@ describe('BoardService', () => {
...
@@ -76,7 +73,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
createList
(
entityId
,
entityType
))
return
expect
(
boardsStor
e
.
createList
(
entityId
,
entityType
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -86,7 +83,7 @@ describe('BoardService', () => {
...
@@ -86,7 +83,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
createList
(
entityId
,
entityType
))
return
expect
(
boardsStor
e
.
createList
(
entityId
,
entityType
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -113,7 +110,7 @@ describe('BoardService', () => {
...
@@ -113,7 +110,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
updateList
(
id
,
position
,
collapsed
))
return
expect
(
boardsStor
e
.
updateList
(
id
,
position
,
collapsed
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -123,7 +120,7 @@ describe('BoardService', () => {
...
@@ -123,7 +120,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
updateList
(
id
,
position
,
collapsed
))
return
expect
(
boardsStor
e
.
updateList
(
id
,
position
,
collapsed
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -147,7 +144,7 @@ describe('BoardService', () => {
...
@@ -147,7 +144,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
destroyList
(
id
))
return
expect
(
boardsStor
e
.
destroyList
(
id
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalled
();
expect
(
requestSpy
).
toHaveBeenCalled
();
...
@@ -157,7 +154,7 @@ describe('BoardService', () => {
...
@@ -157,7 +154,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
destroyList
(
id
))
return
expect
(
boardsStor
e
.
destroyList
(
id
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalled
();
expect
(
requestSpy
).
toHaveBeenCalled
();
...
@@ -173,7 +170,7 @@ describe('BoardService', () => {
...
@@ -173,7 +170,7 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
getIssuesForList
(
id
)).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
getIssuesForList
(
id
)).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
makes a request to fetch list issues with filter
'
,
()
=>
{
it
(
'
makes a request to fetch list issues with filter
'
,
()
=>
{
...
@@ -181,13 +178,13 @@ describe('BoardService', () => {
...
@@ -181,13 +178,13 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
`
${
url
}
&algal=scrubber`
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
`
${
url
}
&algal=scrubber`
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
getIssuesForList
(
id
,
filter
)).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
getIssuesForList
(
id
,
filter
)).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
return
expect
(
servic
e
.
getIssuesForList
(
id
)).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
getIssuesForList
(
id
)).
rejects
.
toThrow
();
});
});
});
});
...
@@ -228,7 +225,7 @@ describe('BoardService', () => {
...
@@ -228,7 +225,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
moveIssue
(
id
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
))
return
expect
(
boardsStor
e
.
moveIssue
(
id
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -238,7 +235,7 @@ describe('BoardService', () => {
...
@@ -238,7 +235,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
moveIssue
(
id
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
))
return
expect
(
boardsStor
e
.
moveIssue
(
id
,
fromListId
,
toListId
,
moveBeforeId
,
moveAfterId
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -267,7 +264,7 @@ describe('BoardService', () => {
...
@@ -267,7 +264,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
newIssue
(
id
,
issue
))
return
expect
(
boardsStor
e
.
newIssue
(
id
,
issue
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -277,7 +274,7 @@ describe('BoardService', () => {
...
@@ -277,7 +274,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
newIssue
(
id
,
issue
))
return
expect
(
boardsStor
e
.
newIssue
(
id
,
issue
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -304,13 +301,13 @@ describe('BoardService', () => {
...
@@ -304,13 +301,13 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
getBacklog
(
requestParams
)).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
getBacklog
(
requestParams
)).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
return
expect
(
servic
e
.
getBacklog
(
requestParams
)).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
getBacklog
(
requestParams
)).
rejects
.
toThrow
();
});
});
});
});
...
@@ -337,7 +334,7 @@ describe('BoardService', () => {
...
@@ -337,7 +334,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
bulkUpdate
(
issueIds
,
extraData
))
return
expect
(
boardsStor
e
.
bulkUpdate
(
issueIds
,
extraData
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -347,7 +344,7 @@ describe('BoardService', () => {
...
@@ -347,7 +344,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
bulkUpdate
(
issueIds
,
extraData
))
return
expect
(
boardsStor
e
.
bulkUpdate
(
issueIds
,
extraData
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -362,13 +359,13 @@ describe('BoardService', () => {
...
@@ -362,13 +359,13 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
dummyEndpoint
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
dummyEndpoint
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
BoardServic
e
.
getIssueInfo
(
dummyEndpoint
)).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
getIssueInfo
(
dummyEndpoint
)).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onGet
(
dummyEndpoint
).
replyOnce
(
500
);
axiosMock
.
onGet
(
dummyEndpoint
).
replyOnce
(
500
);
return
expect
(
BoardServic
e
.
getIssueInfo
(
dummyEndpoint
)).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
getIssueInfo
(
dummyEndpoint
)).
rejects
.
toThrow
();
});
});
});
});
...
@@ -379,7 +376,7 @@ describe('BoardService', () => {
...
@@ -379,7 +376,7 @@ describe('BoardService', () => {
axiosMock
.
onPost
(
dummyEndpoint
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onPost
(
dummyEndpoint
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
BoardServic
e
.
toggleIssueSubscription
(
dummyEndpoint
)).
resolves
.
toEqual
(
return
expect
(
boardsStor
e
.
toggleIssueSubscription
(
dummyEndpoint
)).
resolves
.
toEqual
(
expectedResponse
,
expectedResponse
,
);
);
});
});
...
@@ -387,7 +384,7 @@ describe('BoardService', () => {
...
@@ -387,7 +384,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onPost
(
dummyEndpoint
).
replyOnce
(
500
);
axiosMock
.
onPost
(
dummyEndpoint
).
replyOnce
(
500
);
return
expect
(
BoardServic
e
.
toggleIssueSubscription
(
dummyEndpoint
)).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
toggleIssueSubscription
(
dummyEndpoint
)).
rejects
.
toThrow
();
});
});
});
});
...
@@ -398,13 +395,13 @@ describe('BoardService', () => {
...
@@ -398,13 +395,13 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
allBoards
()).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
allBoards
()).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
return
expect
(
servic
e
.
allBoards
()).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
allBoards
()).
rejects
.
toThrow
();
});
});
});
});
...
@@ -415,13 +412,13 @@ describe('BoardService', () => {
...
@@ -415,13 +412,13 @@ describe('BoardService', () => {
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onGet
(
url
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
recentBoards
()).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
recentBoards
()).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
axiosMock
.
onGet
(
url
).
replyOnce
(
500
);
return
expect
(
servic
e
.
recentBoards
()).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
recentBoards
()).
rejects
.
toThrow
();
});
});
});
});
...
@@ -462,7 +459,7 @@ describe('BoardService', () => {
...
@@ -462,7 +459,7 @@ describe('BoardService', () => {
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
return
expect
(
servic
e
.
createBoard
({
boardsStor
e
.
createBoard
({
...
board
,
...
board
,
id
,
id
,
}),
}),
...
@@ -477,7 +474,7 @@ describe('BoardService', () => {
...
@@ -477,7 +474,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
return
expect
(
servic
e
.
createBoard
({
boardsStor
e
.
createBoard
({
...
board
,
...
board
,
id
,
id
,
}),
}),
...
@@ -513,7 +510,7 @@ describe('BoardService', () => {
...
@@ -513,7 +510,7 @@ describe('BoardService', () => {
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
createBoard
(
board
))
return
expect
(
boardsStor
e
.
createBoard
(
board
))
.
resolves
.
toEqual
(
expectedResponse
)
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -523,7 +520,7 @@ describe('BoardService', () => {
...
@@ -523,7 +520,7 @@ describe('BoardService', () => {
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
servic
e
.
createBoard
(
board
))
return
expect
(
boardsStor
e
.
createBoard
(
board
))
.
rejects
.
toThrow
()
.
rejects
.
toThrow
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
...
@@ -540,13 +537,13 @@ describe('BoardService', () => {
...
@@ -540,13 +537,13 @@ describe('BoardService', () => {
axiosMock
.
onDelete
(
url
).
replyOnce
(
200
,
dummyResponse
);
axiosMock
.
onDelete
(
url
).
replyOnce
(
200
,
dummyResponse
);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
servic
e
.
deleteBoard
({
id
})).
resolves
.
toEqual
(
expectedResponse
);
return
expect
(
boardsStor
e
.
deleteBoard
({
id
})).
resolves
.
toEqual
(
expectedResponse
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
it
(
'
fails for error response
'
,
()
=>
{
axiosMock
.
onDelete
(
url
).
replyOnce
(
500
);
axiosMock
.
onDelete
(
url
).
replyOnce
(
500
);
return
expect
(
servic
e
.
deleteBoard
({
id
})).
rejects
.
toThrow
();
return
expect
(
boardsStor
e
.
deleteBoard
({
id
})).
rejects
.
toThrow
();
});
});
});
});
});
});
spec/javascripts/boards/boards_store_spec.js
View file @
fa3a2166
...
@@ -8,7 +8,6 @@ import '~/boards/models/label';
...
@@ -8,7 +8,6 @@ import '~/boards/models/label';
import
'
~/boards/models/assignee
'
;
import
'
~/boards/models/assignee
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
eventHub
from
'
~/boards/eventhub
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
}
from
'
./mock_data
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
}
from
'
./mock_data
'
;
...
...
spec/javascripts/boards/issue_spec.js
View file @
fa3a2166
...
@@ -5,7 +5,6 @@ import '~/boards/models/label';
...
@@ -5,7 +5,6 @@ import '~/boards/models/label';
import
'
~/boards/models/assignee
'
;
import
'
~/boards/models/assignee
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
setMockEndpoints
}
from
'
./mock_data
'
;
import
{
setMockEndpoints
}
from
'
./mock_data
'
;
...
...
spec/javascripts/boards/list_spec.js
View file @
fa3a2166
...
@@ -10,7 +10,6 @@ import '~/boards/models/label';
...
@@ -10,7 +10,6 @@ import '~/boards/models/label';
import
'
~/boards/models/assignee
'
;
import
'
~/boards/models/assignee
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/issue
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/models/list
'
;
import
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
}
from
'
./mock_data
'
;
import
{
listObj
,
listObjDuplicate
,
boardsMockInterceptor
}
from
'
./mock_data
'
;
...
...
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