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
8ca18878
Commit
8ca18878
authored
Nov 26, 2019
by
Marvin Karegyeya
Committed by
Martin Wortschack
Nov 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete board_service.js file
parent
1d6332a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
80 deletions
+40
-80
ee/app/assets/javascripts/boards/services/board_service.js
ee/app/assets/javascripts/boards/services/board_service.js
+0
-14
ee/changelogs/unreleased/Update-board_service-js-to-use-boardsStore.yml
...unreleased/Update-board_service-js-to-use-boardsStore.yml
+5
-0
ee/spec/frontend/boards/services/board_service_spec.js
ee/spec/frontend/boards/services/board_service_spec.js
+0
-66
ee/spec/frontend/boards/stores/boards_store_ee_spec.js
ee/spec/frontend/boards/stores/boards_store_ee_spec.js
+35
-0
No files found.
ee/app/assets/javascripts/boards/services/board_service.js
deleted
100644 → 0
View file @
1d6332a8
/**
* 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
BoardService
from
'
~/boards/services/board_service
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
export
default
class
BoardServiceEE
extends
BoardService
{
static
updateWeight
(
endpoint
,
weight
=
null
)
{
return
boardsStore
.
updateWeight
(
endpoint
,
weight
);
}
}
ee/changelogs/unreleased/Update-board_service-js-to-use-boardsStore.yml
0 → 100644
View file @
8ca18878
---
title
:
Updated board_service.js to use boardStore directly
merge_request
:
20141
author
:
nuwe1
type
:
other
ee/spec/frontend/boards/services/board_service_spec.js
deleted
100644 → 0
View file @
1d6332a8
import
BoardServiceEE
from
'
ee/boards/services/board_service
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
describe
(
'
BoardService
'
,
()
=>
{
const
dummyResponse
=
'
just another response in the network
'
;
const
boardId
=
'
dummy-board-id
'
;
const
endpoints
=
{
boardsEndpoint
:
`
${
TEST_HOST
}
/boards`
,
listsEndpoint
:
`
${
TEST_HOST
}
/lists`
,
bulkUpdatePath
:
`
${
TEST_HOST
}
/bulk/update`
,
recentBoardsEndpoint
:
`
${
TEST_HOST
}
/recent/boards`
,
};
let
axiosMock
;
beforeEach
(()
=>
{
axiosMock
=
new
AxiosMockAdapter
(
axios
);
boardsStore
.
setEndpoints
({
...
endpoints
,
boardId
,
});
});
describe
(
'
updateWeight
'
,
()
=>
{
const
dummyEndpoint
=
`
${
TEST_HOST
}
/update/weight`
;
const
weight
=
'
elephant
'
;
const
expectedRequest
=
expect
.
objectContaining
({
data
:
JSON
.
stringify
({
weight
})
});
let
requestSpy
;
beforeEach
(()
=>
{
requestSpy
=
jest
.
fn
();
axiosMock
.
onPut
(
dummyEndpoint
).
replyOnce
(
config
=>
requestSpy
(
config
));
});
it
(
'
makes a request to update the weight
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
BoardServiceEE
.
updateWeight
(
dummyEndpoint
,
weight
))
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
BoardServiceEE
.
updateWeight
(
dummyEndpoint
,
weight
))
.
rejects
.
toThrow
()
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
});
});
});
});
ee/spec/frontend/boards/stores/boards_store_ee_spec.js
View file @
8ca18878
...
...
@@ -88,4 +88,39 @@ describe('BoardsStoreEE', () => {
expect
(
state
.
milestones
).
toEqual
([]);
});
});
describe
(
'
updateWeight
'
,
()
=>
{
const
dummyEndpoint
=
`
${
TEST_HOST
}
/update/weight`
;
const
dummyResponse
=
'
just another response in the network
'
;
const
weight
=
'
elephant
'
;
const
expectedRequest
=
expect
.
objectContaining
({
data
:
JSON
.
stringify
({
weight
})
});
let
requestSpy
;
beforeEach
(()
=>
{
requestSpy
=
jest
.
fn
();
axiosMock
.
onPut
(
dummyEndpoint
).
replyOnce
(
config
=>
requestSpy
(
config
));
});
it
(
'
makes a request to update the weight
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
200
,
dummyResponse
]);
const
expectedResponse
=
expect
.
objectContaining
({
data
:
dummyResponse
});
return
expect
(
BoardsStoreEE
.
store
.
updateWeight
(
dummyEndpoint
,
weight
))
.
resolves
.
toEqual
(
expectedResponse
)
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
});
});
it
(
'
fails for error response
'
,
()
=>
{
requestSpy
.
mockReturnValue
([
500
]);
return
expect
(
BoardsStoreEE
.
store
.
updateWeight
(
dummyEndpoint
,
weight
))
.
rejects
.
toThrow
()
.
then
(()
=>
{
expect
(
requestSpy
).
toHaveBeenCalledWith
(
expectedRequest
);
});
});
});
});
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