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
7162ae25
Commit
7162ae25
authored
Apr 29, 2020
by
Nicolò Maria Mezzopera
Committed by
Denys Mishunov
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move group_store to jest
- group_store_spec - mock data
parent
f7773b61
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
190 additions
and
231 deletions
+190
-231
app/assets/javascripts/groups/components/app.vue
app/assets/javascripts/groups/components/app.vue
+3
-4
spec/frontend/groups/components/app_spec.js
spec/frontend/groups/components/app_spec.js
+134
-160
spec/frontend/groups/components/group_folder_spec.js
spec/frontend/groups/components/group_folder_spec.js
+2
-4
spec/frontend/groups/components/group_item_spec.js
spec/frontend/groups/components/group_item_spec.js
+13
-16
spec/frontend/groups/components/groups_spec.js
spec/frontend/groups/components/groups_spec.js
+11
-15
spec/frontend/groups/components/item_actions_spec.js
spec/frontend/groups/components/item_actions_spec.js
+2
-2
spec/frontend/groups/components/item_caret_spec.js
spec/frontend/groups/components/item_caret_spec.js
+10
-10
spec/frontend/groups/components/item_stats_spec.js
spec/frontend/groups/components/item_stats_spec.js
+1
-1
spec/frontend/groups/components/item_stats_value_spec.js
spec/frontend/groups/components/item_stats_value_spec.js
+5
-5
spec/frontend/groups/components/item_type_icon_spec.js
spec/frontend/groups/components/item_type_icon_spec.js
+1
-6
spec/frontend/groups/mock_data.js
spec/frontend/groups/mock_data.js
+0
-0
spec/frontend/groups/service/groups_service_spec.js
spec/frontend/groups/service/groups_service_spec.js
+2
-2
spec/frontend/groups/store/groups_store_spec.js
spec/frontend/groups/store/groups_store_spec.js
+6
-6
No files found.
app/assets/javascripts/groups/components/app.vue
View file @
7162ae25
...
@@ -111,8 +111,8 @@ export default {
...
@@ -111,8 +111,8 @@ export default {
const
filterGroupsBy
=
getParameterByName
(
'
filter
'
)
||
null
;
const
filterGroupsBy
=
getParameterByName
(
'
filter
'
)
||
null
;
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
// eslint-disable-next-line promise/catch-or-return
this
.
fetchGroups
({
return
this
.
fetchGroups
({
page
,
page
,
filterGroupsBy
,
filterGroupsBy
,
sortBy
,
sortBy
,
...
@@ -126,8 +126,7 @@ export default {
...
@@ -126,8 +126,7 @@ export default {
fetchPage
(
page
,
filterGroupsBy
,
sortBy
,
archived
)
{
fetchPage
(
page
,
filterGroupsBy
,
sortBy
,
archived
)
{
this
.
isLoading
=
true
;
this
.
isLoading
=
true
;
// eslint-disable-next-line promise/catch-or-return
return
this
.
fetchGroups
({
this
.
fetchGroups
({
page
,
page
,
filterGroupsBy
,
filterGroupsBy
,
sortBy
,
sortBy
,
...
...
spec/
javascripts
/groups/components/app_spec.js
→
spec/
frontend
/groups/components/app_spec.js
View file @
7162ae25
This diff is collapsed.
Click to expand it.
spec/
javascripts
/groups/components/group_folder_spec.js
→
spec/
frontend
/groups/components/group_folder_spec.js
View file @
7162ae25
...
@@ -18,15 +18,13 @@ const createComponent = (groups = mockGroups, parentGroup = mockParentGroupItem)
...
@@ -18,15 +18,13 @@ const createComponent = (groups = mockGroups, parentGroup = mockParentGroupItem)
describe
(
'
GroupFolderComponent
'
,
()
=>
{
describe
(
'
GroupFolderComponent
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
(
done
=>
{
beforeEach
(
()
=>
{
Vue
.
component
(
'
group-item
'
,
groupItemComponent
);
Vue
.
component
(
'
group-item
'
,
groupItemComponent
);
vm
=
createComponent
();
vm
=
createComponent
();
vm
.
$mount
();
vm
.
$mount
();
Vue
.
nextTick
(()
=>
{
return
Vue
.
nextTick
();
done
();
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
...
spec/
javascripts
/groups/components/group_item_spec.js
→
spec/
frontend
/groups/components/group_item_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
*
as
urlUtilities
from
'
~/lib/utils/url_utility
'
;
import
{
mockParentGroupItem
,
mockChildren
}
from
'
../mock_data
'
;
import
{
mockParentGroupItem
,
mockChildren
}
from
'
../mock_data
'
;
const
createComponent
=
(
group
=
mockParentGroupItem
,
parentGroup
=
mockChildren
[
0
])
=>
{
const
createComponent
=
(
group
=
mockParentGroupItem
,
parentGroup
=
mockChildren
[
0
])
=>
{
...
@@ -17,14 +18,12 @@ const createComponent = (group = mockParentGroupItem, parentGroup = mockChildren
...
@@ -17,14 +18,12 @@ const createComponent = (group = mockParentGroupItem, parentGroup = mockChildren
describe
(
'
GroupItemComponent
'
,
()
=>
{
describe
(
'
GroupItemComponent
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
(
done
=>
{
beforeEach
(
()
=>
{
Vue
.
component
(
'
group-folder
'
,
groupFolderComponent
);
Vue
.
component
(
'
group-folder
'
,
groupFolderComponent
);
vm
=
createComponent
();
vm
=
createComponent
();
Vue
.
nextTick
(()
=>
{
return
Vue
.
nextTick
();
done
();
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -130,26 +129,24 @@ describe('GroupItemComponent', () => {
...
@@ -130,26 +129,24 @@ describe('GroupItemComponent', () => {
});
});
it
(
'
should emit `toggleChildren` event when expand is clicked on a group and it has children present
'
,
()
=>
{
it
(
'
should emit `toggleChildren` event when expand is clicked on a group and it has children present
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{}
);
vm
.
onClickRowGroup
(
event
);
vm
.
onClickRowGroup
(
event
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
toggleChildren
'
,
vm
.
group
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
toggleChildren
'
,
vm
.
group
);
});
});
it
(
'
should navigate page to group homepage if group does not have any children present
'
,
done
=>
{
it
(
'
should navigate page to group homepage if group does not have any children present
'
,
()
=>
{
jest
.
spyOn
(
urlUtilities
,
'
visitUrl
'
).
mockImplementation
();
const
group
=
Object
.
assign
({},
mockParentGroupItem
);
const
group
=
Object
.
assign
({},
mockParentGroupItem
);
group
.
childrenCount
=
0
;
group
.
childrenCount
=
0
;
const
newVm
=
createComponent
(
group
);
const
newVm
=
createComponent
(
group
);
const
visitUrl
=
spyOnDependency
(
groupItemComponent
,
'
visitUrl
'
).
and
.
stub
();
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{});
spyOn
(
eventHub
,
'
$emit
'
);
newVm
.
onClickRowGroup
(
event
);
newVm
.
onClickRowGroup
(
event
);
setTimeout
(()
=>
{
expect
(
eventHub
.
$emit
).
not
.
toHaveBeenCalled
();
expect
(
eventHub
.
$emit
).
not
.
toHaveBeenCalled
();
expect
(
visitUrl
).
toHaveBeenCalledWith
(
newVm
.
group
.
relativePath
);
expect
(
urlUtilities
.
visitUrl
).
toHaveBeenCalledWith
(
newVm
.
group
.
relativePath
);
done
();
},
0
);
});
});
});
});
});
});
...
@@ -167,7 +164,7 @@ describe('GroupItemComponent', () => {
...
@@ -167,7 +164,7 @@ describe('GroupItemComponent', () => {
const
badgeEl
=
vm
.
$el
.
querySelector
(
'
.badge-warning
'
);
const
badgeEl
=
vm
.
$el
.
querySelector
(
'
.badge-warning
'
);
expect
(
badgeEl
).
toBeDefined
();
expect
(
badgeEl
).
toBeDefined
();
expect
(
badgeEl
).
toContainText
(
'
pending removal
'
);
expect
(
badgeEl
.
innerHTML
).
toContain
(
'
pending removal
'
);
});
});
});
});
...
@@ -180,7 +177,7 @@ describe('GroupItemComponent', () => {
...
@@ -180,7 +177,7 @@ describe('GroupItemComponent', () => {
it
(
'
does not render the group pending removal badge
'
,
()
=>
{
it
(
'
does not render the group pending removal badge
'
,
()
=>
{
const
groupTextContainer
=
vm
.
$el
.
querySelector
(
'
.group-text-container
'
);
const
groupTextContainer
=
vm
.
$el
.
querySelector
(
'
.group-text-container
'
);
expect
(
groupTextContainer
).
not
.
toContain
Text
(
'
pending removal
'
);
expect
(
groupTextContainer
).
not
.
toContain
(
'
pending removal
'
);
});
});
});
});
...
...
spec/
javascripts
/groups/components/groups_spec.js
→
spec/
frontend
/groups/components/groups_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
groupsComponent
from
'
~/groups/components/groups.vue
'
;
import
groupsComponent
from
'
~/groups/components/groups.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
groupFolderComponent
from
'
~/groups/components/group_folder.vue
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
import
groupItemComponent
from
'
~/groups/components/group_item.vue
'
;
...
@@ -21,15 +21,13 @@ const createComponent = (searchEmpty = false) => {
...
@@ -21,15 +21,13 @@ const createComponent = (searchEmpty = false) => {
describe
(
'
GroupsComponent
'
,
()
=>
{
describe
(
'
GroupsComponent
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
(
done
=>
{
beforeEach
(
()
=>
{
Vue
.
component
(
'
group-folder
'
,
groupFolderComponent
);
Vue
.
component
(
'
group-folder
'
,
groupFolderComponent
);
Vue
.
component
(
'
group-item
'
,
groupItemComponent
);
Vue
.
component
(
'
group-item
'
,
groupItemComponent
);
vm
=
createComponent
();
vm
=
createComponent
();
Vue
.
nextTick
(()
=>
{
return
vm
.
$nextTick
();
done
();
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -39,37 +37,35 @@ describe('GroupsComponent', () => {
...
@@ -39,37 +37,35 @@ describe('GroupsComponent', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
change
'
,
()
=>
{
describe
(
'
change
'
,
()
=>
{
it
(
'
should emit `fetchPage` event when page is changed via pagination
'
,
()
=>
{
it
(
'
should emit `fetchPage` event when page is changed via pagination
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
).
and
.
stub
();
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
();
vm
.
change
(
2
);
vm
.
change
(
2
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
fetchPage
'
,
'
fetchPage
'
,
2
,
2
,
jasmine
.
any
(
Object
),
expect
.
any
(
Object
),
jasmine
.
any
(
Object
),
expect
.
any
(
Object
),
jasmine
.
any
(
Object
),
expect
.
any
(
Object
),
);
);
});
});
});
});
});
});
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component template correctly
'
,
done
=>
{
it
(
'
should render component template correctly
'
,
()
=>
{
Vue
.
nextTick
(()
=>
{
return
vm
.
$nextTick
().
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.groups-list-tree-container
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.groups-list-tree-container
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.group-list-tree
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.group-list-tree
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.gl-pagination
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.gl-pagination
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
.has-no-search-results
'
).
length
).
toBe
(
0
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.has-no-search-results
'
).
length
).
toBe
(
0
);
done
();
});
});
});
});
it
(
'
should render empty search message when `searchEmpty` is `true`
'
,
done
=>
{
it
(
'
should render empty search message when `searchEmpty` is `true`
'
,
()
=>
{
vm
.
searchEmpty
=
true
;
vm
.
searchEmpty
=
true
;
Vue
.
nextTick
(()
=>
{
return
vm
.
$nextTick
().
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.has-no-search-results
'
)).
toBeDefined
();
expect
(
vm
.
$el
.
querySelector
(
'
.has-no-search-results
'
)).
toBeDefined
();
done
();
});
});
});
});
});
});
...
...
spec/
javascripts
/groups/components/item_actions_spec.js
→
spec/
frontend
/groups/components/item_actions_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
itemActionsComponent
from
'
~/groups/components/item_actions.vue
'
;
import
itemActionsComponent
from
'
~/groups/components/item_actions.vue
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
eventHub
from
'
~/groups/event_hub
'
;
import
{
mockParentGroupItem
,
mockChildren
}
from
'
../mock_data
'
;
import
{
mockParentGroupItem
,
mockChildren
}
from
'
../mock_data
'
;
...
@@ -28,7 +28,7 @@ describe('ItemActionsComponent', () => {
...
@@ -28,7 +28,7 @@ describe('ItemActionsComponent', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
onLeaveGroup
'
,
()
=>
{
describe
(
'
onLeaveGroup
'
,
()
=>
{
it
(
'
emits `showLeaveGroupModal` event with `group` and `parentGroup` props
'
,
()
=>
{
it
(
'
emits `showLeaveGroupModal` event with `group` and `parentGroup` props
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
(()
=>
{}
);
vm
.
onLeaveGroup
();
vm
.
onLeaveGroup
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
...
...
spec/
javascripts
/groups/components/item_caret_spec.js
→
spec/
frontend
/groups/components/item_caret_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
itemCaretComponent
from
'
~/groups/components/item_caret.vue
'
;
import
itemCaretComponent
from
'
~/groups/components/item_caret.vue
'
;
const
createComponent
=
(
isGroupOpen
=
false
)
=>
{
const
createComponent
=
(
isGroupOpen
=
false
)
=>
{
...
@@ -12,27 +12,27 @@ const createComponent = (isGroupOpen = false) => {
...
@@ -12,27 +12,27 @@ const createComponent = (isGroupOpen = false) => {
};
};
describe
(
'
ItemCaretComponent
'
,
()
=>
{
describe
(
'
ItemCaretComponent
'
,
()
=>
{
let
vm
;
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component template correctly
'
,
()
=>
{
it
(
'
should render component template correctly
'
,
()
=>
{
const
vm
=
createComponent
();
vm
=
createComponent
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
folder-caret
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
folder-caret
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
svg
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
svg
'
).
length
).
toBe
(
1
);
vm
.
$destroy
();
});
});
it
(
'
should render caret down icon if `isGroupOpen` prop is `true`
'
,
()
=>
{
it
(
'
should render caret down icon if `isGroupOpen` prop is `true`
'
,
()
=>
{
const
vm
=
createComponent
(
true
);
vm
=
createComponent
(
true
);
expect
(
vm
.
$el
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
angle-down
'
);
expect
(
vm
.
$el
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
angle-down
'
);
vm
.
$destroy
();
});
});
it
(
'
should render caret right icon if `isGroupOpen` prop is `false`
'
,
()
=>
{
it
(
'
should render caret right icon if `isGroupOpen` prop is `false`
'
,
()
=>
{
const
vm
=
createComponent
();
vm
=
createComponent
();
expect
(
vm
.
$el
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
angle-right
'
);
expect
(
vm
.
$el
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
angle-right
'
);
vm
.
$destroy
();
});
});
});
});
});
});
spec/
javascripts
/groups/components/item_stats_spec.js
→
spec/
frontend
/groups/components/item_stats_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
itemStatsComponent
from
'
~/groups/components/item_stats.vue
'
;
import
itemStatsComponent
from
'
~/groups/components/item_stats.vue
'
;
import
{
import
{
mockParentGroupItem
,
mockParentGroupItem
,
...
...
spec/
javascripts
/groups/components/item_stats_value_spec.js
→
spec/
frontend
/groups/components/item_stats_value_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
itemStatsValueComponent
from
'
~/groups/components/item_stats_value.vue
'
;
import
itemStatsValueComponent
from
'
~/groups/components/item_stats_value.vue
'
;
const
createComponent
=
({
title
,
cssClass
,
iconName
,
tooltipPlacement
,
value
})
=>
{
const
createComponent
=
({
title
,
cssClass
,
iconName
,
tooltipPlacement
,
value
})
=>
{
...
@@ -56,6 +56,10 @@ describe('ItemStatsValueComponent', () => {
...
@@ -56,6 +56,10 @@ describe('ItemStatsValueComponent', () => {
});
});
});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'
renders component element correctly
'
,
()
=>
{
it
(
'
renders component element correctly
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
number-subgroups
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
number-subgroups
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
svg
'
).
length
).
toBeGreaterThan
(
0
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
svg
'
).
length
).
toBeGreaterThan
(
0
);
...
@@ -74,9 +78,5 @@ describe('ItemStatsValueComponent', () => {
...
@@ -74,9 +78,5 @@ describe('ItemStatsValueComponent', () => {
it
(
'
renders value count correctly
'
,
()
=>
{
it
(
'
renders value count correctly
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.stat-value
'
).
innerText
.
trim
()).
toContain
(
'
10
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.stat-value
'
).
innerText
.
trim
()).
toContain
(
'
10
'
);
});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
});
});
});
});
spec/
javascripts
/groups/components/item_type_icon_spec.js
→
spec/
frontend
/groups/components/item_type_icon_spec.js
View file @
7162ae25
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
itemTypeIconComponent
from
'
~/groups/components/item_type_icon.vue
'
;
import
itemTypeIconComponent
from
'
~/groups/components/item_type_icon.vue
'
;
import
{
ITEM_TYPE
}
from
'
../mock_data
'
;
import
{
ITEM_TYPE
}
from
'
../mock_data
'
;
...
@@ -17,7 +17,6 @@ describe('ItemTypeIconComponent', () => {
...
@@ -17,7 +17,6 @@ describe('ItemTypeIconComponent', () => {
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component template correctly
'
,
()
=>
{
it
(
'
should render component template correctly
'
,
()
=>
{
const
vm
=
createComponent
();
const
vm
=
createComponent
();
vm
.
$mount
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
item-type-icon
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
item-type-icon
'
)).
toBeTruthy
();
vm
.
$destroy
();
vm
.
$destroy
();
...
@@ -27,13 +26,11 @@ describe('ItemTypeIconComponent', () => {
...
@@ -27,13 +26,11 @@ describe('ItemTypeIconComponent', () => {
let
vm
;
let
vm
;
vm
=
createComponent
(
ITEM_TYPE
.
GROUP
,
true
);
vm
=
createComponent
(
ITEM_TYPE
.
GROUP
,
true
);
vm
.
$mount
();
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
folder-open
'
);
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
folder-open
'
);
vm
.
$destroy
();
vm
.
$destroy
();
vm
=
createComponent
(
ITEM_TYPE
.
GROUP
);
vm
=
createComponent
(
ITEM_TYPE
.
GROUP
);
vm
.
$mount
();
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
folder
'
);
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
folder
'
);
vm
.
$destroy
();
vm
.
$destroy
();
...
@@ -43,13 +40,11 @@ describe('ItemTypeIconComponent', () => {
...
@@ -43,13 +40,11 @@ describe('ItemTypeIconComponent', () => {
let
vm
;
let
vm
;
vm
=
createComponent
(
ITEM_TYPE
.
PROJECT
);
vm
=
createComponent
(
ITEM_TYPE
.
PROJECT
);
vm
.
$mount
();
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
bookmark
'
);
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
bookmark
'
);
vm
.
$destroy
();
vm
.
$destroy
();
vm
=
createComponent
(
ITEM_TYPE
.
GROUP
);
vm
=
createComponent
(
ITEM_TYPE
.
GROUP
);
vm
.
$mount
();
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
not
.
toContain
(
'
bookmark
'
);
expect
(
vm
.
$el
.
querySelector
(
'
use
'
).
getAttribute
(
'
xlink:href
'
)).
not
.
toContain
(
'
bookmark
'
);
vm
.
$destroy
();
vm
.
$destroy
();
...
...
spec/
javascripts
/groups/mock_data.js
→
spec/
frontend
/groups/mock_data.js
View file @
7162ae25
File moved
spec/
javascripts
/groups/service/groups_service_spec.js
→
spec/
frontend
/groups/service/groups_service_spec.js
View file @
7162ae25
...
@@ -12,7 +12,7 @@ describe('GroupsService', () => {
...
@@ -12,7 +12,7 @@ describe('GroupsService', () => {
describe
(
'
getGroups
'
,
()
=>
{
describe
(
'
getGroups
'
,
()
=>
{
it
(
'
should return promise for `GET` request on provided endpoint
'
,
()
=>
{
it
(
'
should return promise for `GET` request on provided endpoint
'
,
()
=>
{
spyOn
(
axios
,
'
get
'
).
and
.
stub
();
jest
.
spyOn
(
axios
,
'
get
'
).
mockResolvedValue
();
const
params
=
{
const
params
=
{
page
:
2
,
page
:
2
,
filter
:
'
git
'
,
filter
:
'
git
'
,
...
@@ -32,7 +32,7 @@ describe('GroupsService', () => {
...
@@ -32,7 +32,7 @@ describe('GroupsService', () => {
describe
(
'
leaveGroup
'
,
()
=>
{
describe
(
'
leaveGroup
'
,
()
=>
{
it
(
'
should return promise for `DELETE` request on provided endpoint
'
,
()
=>
{
it
(
'
should return promise for `DELETE` request on provided endpoint
'
,
()
=>
{
spyOn
(
axios
,
'
delete
'
).
and
.
stub
();
jest
.
spyOn
(
axios
,
'
delete
'
).
mockResolvedValue
();
service
.
leaveGroup
(
mockParentGroupItem
.
leavePath
);
service
.
leaveGroup
(
mockParentGroupItem
.
leavePath
);
...
...
spec/
javascripts
/groups/store/groups_store_spec.js
→
spec/
frontend
/groups/store/groups_store_spec.js
View file @
7162ae25
...
@@ -28,12 +28,12 @@ describe('ProjectsStore', () => {
...
@@ -28,12 +28,12 @@ describe('ProjectsStore', () => {
describe
(
'
setGroups
'
,
()
=>
{
describe
(
'
setGroups
'
,
()
=>
{
it
(
'
should set groups to state
'
,
()
=>
{
it
(
'
should set groups to state
'
,
()
=>
{
const
store
=
new
GroupsStore
();
const
store
=
new
GroupsStore
();
spyOn
(
store
,
'
formatGroupItem
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
store
,
'
formatGroupItem
'
);
store
.
setGroups
(
mockGroups
);
store
.
setGroups
(
mockGroups
);
expect
(
store
.
state
.
groups
.
length
).
toBe
(
mockGroups
.
length
);
expect
(
store
.
state
.
groups
.
length
).
toBe
(
mockGroups
.
length
);
expect
(
store
.
formatGroupItem
).
toHaveBeenCalledWith
(
jasmine
.
any
(
Object
));
expect
(
store
.
formatGroupItem
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
));
expect
(
Object
.
keys
(
store
.
state
.
groups
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
);
expect
(
Object
.
keys
(
store
.
state
.
groups
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
);
});
});
});
});
...
@@ -41,12 +41,12 @@ describe('ProjectsStore', () => {
...
@@ -41,12 +41,12 @@ describe('ProjectsStore', () => {
describe
(
'
setSearchedGroups
'
,
()
=>
{
describe
(
'
setSearchedGroups
'
,
()
=>
{
it
(
'
should set searched groups to state
'
,
()
=>
{
it
(
'
should set searched groups to state
'
,
()
=>
{
const
store
=
new
GroupsStore
();
const
store
=
new
GroupsStore
();
spyOn
(
store
,
'
formatGroupItem
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
store
,
'
formatGroupItem
'
);
store
.
setSearchedGroups
(
mockSearchedGroups
);
store
.
setSearchedGroups
(
mockSearchedGroups
);
expect
(
store
.
state
.
groups
.
length
).
toBe
(
mockSearchedGroups
.
length
);
expect
(
store
.
state
.
groups
.
length
).
toBe
(
mockSearchedGroups
.
length
);
expect
(
store
.
formatGroupItem
).
toHaveBeenCalledWith
(
jasmine
.
any
(
Object
));
expect
(
store
.
formatGroupItem
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
));
expect
(
Object
.
keys
(
store
.
state
.
groups
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
);
expect
(
Object
.
keys
(
store
.
state
.
groups
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
);
expect
(
Object
.
keys
(
store
.
state
.
groups
[
0
].
children
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
expect
(
Object
.
keys
(
store
.
state
.
groups
[
0
].
children
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
,
-
1
,
...
@@ -57,11 +57,11 @@ describe('ProjectsStore', () => {
...
@@ -57,11 +57,11 @@ describe('ProjectsStore', () => {
describe
(
'
setGroupChildren
'
,
()
=>
{
describe
(
'
setGroupChildren
'
,
()
=>
{
it
(
'
should set children to group item in state
'
,
()
=>
{
it
(
'
should set children to group item in state
'
,
()
=>
{
const
store
=
new
GroupsStore
();
const
store
=
new
GroupsStore
();
spyOn
(
store
,
'
formatGroupItem
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
store
,
'
formatGroupItem
'
);
store
.
setGroupChildren
(
mockParentGroupItem
,
mockRawChildren
);
store
.
setGroupChildren
(
mockParentGroupItem
,
mockRawChildren
);
expect
(
store
.
formatGroupItem
).
toHaveBeenCalledWith
(
jasmine
.
any
(
Object
));
expect
(
store
.
formatGroupItem
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
));
expect
(
mockParentGroupItem
.
children
.
length
).
toBe
(
1
);
expect
(
mockParentGroupItem
.
children
.
length
).
toBe
(
1
);
expect
(
Object
.
keys
(
mockParentGroupItem
.
children
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
);
expect
(
Object
.
keys
(
mockParentGroupItem
.
children
[
0
]).
indexOf
(
'
fullName
'
)).
toBeGreaterThan
(
-
1
);
expect
(
mockParentGroupItem
.
isOpen
).
toBeTruthy
();
expect
(
mockParentGroupItem
.
isOpen
).
toBeTruthy
();
...
...
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