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
e545a26f
Commit
e545a26f
authored
Feb 05, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Geo Nodes specs to Jest
Closes
https://gitlab.com/gitlab-org/gitlab/issues/36804
parent
b7c712ea
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
63 additions
and
69 deletions
+63
-69
ee/app/assets/javascripts/geo_nodes/components/app.vue
ee/app/assets/javascripts/geo_nodes/components/app.vue
+1
-1
ee/spec/frontend/geo_nodes/components/app_spec.js
ee/spec/frontend/geo_nodes/components/app_spec.js
+23
-27
ee/spec/frontend/geo_nodes/components/geo_node_actions_spec.js
...ec/frontend/geo_nodes/components/geo_node_actions_spec.js
+3
-5
ee/spec/frontend/geo_nodes/components/geo_node_detail_item_spec.js
...rontend/geo_nodes/components/geo_node_detail_item_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/geo_node_details_spec.js
...ec/frontend/geo_nodes/components/geo_node_details_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/geo_node_event_status_spec.js
...ontend/geo_nodes/components/geo_node_event_status_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/geo_node_header_spec.js
...pec/frontend/geo_nodes/components/geo_node_header_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/geo_node_health_status_spec.js
...ntend/geo_nodes/components/geo_node_health_status_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/geo_node_item_spec.js
ee/spec/frontend/geo_nodes/components/geo_node_item_spec.js
+13
-15
ee/spec/frontend/geo_nodes/components/geo_node_sync_settings_spec.js
...ntend/geo_nodes/components/geo_node_sync_settings_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/geo_nodes_list_spec.js
ee/spec/frontend/geo_nodes/components/geo_nodes_list_spec.js
+1
-1
ee/spec/frontend/geo_nodes/components/node_detail_sections/node_details_section_main_spec.js
...ts/node_detail_sections/node_details_section_main_spec.js
+2
-2
ee/spec/frontend/geo_nodes/components/node_detail_sections/node_details_section_other_spec.js
...s/node_detail_sections/node_details_section_other_spec.js
+2
-2
ee/spec/frontend/geo_nodes/components/node_detail_sections/node_details_section_sync_spec.js
...ts/node_detail_sections/node_details_section_sync_spec.js
+2
-2
ee/spec/frontend/geo_nodes/components/node_detail_sections/node_details_section_verification_spec.js
...detail_sections/node_details_section_verification_spec.js
+2
-2
ee/spec/frontend/geo_nodes/components/node_detail_sections/section_reveal_button_spec.js
...onents/node_detail_sections/section_reveal_button_spec.js
+2
-2
ee/spec/frontend/geo_nodes/mixins/details_section_mixin_spec.js
...c/frontend/geo_nodes/mixins/details_section_mixin_spec.js
+4
-2
ee/spec/frontend/geo_nodes/mock_data.js
ee/spec/frontend/geo_nodes/mock_data.js
+0
-0
ee/spec/frontend/geo_nodes/service/geo_nodes_service_spec.js
ee/spec/frontend/geo_nodes/service/geo_nodes_service_spec.js
+2
-2
ee/spec/frontend/geo_nodes/store/geo_nodes_store_spec.js
ee/spec/frontend/geo_nodes/store/geo_nodes_store_spec.js
+0
-0
No files found.
ee/app/assets/javascripts/geo_nodes/components/app.vue
View file @
e545a26f
...
...
@@ -209,7 +209,7 @@ export default {
<gl-loading-icon
v-if=
"isLoading"
:label=
"s__('GeoNodes|Loading nodes')"
:size=
"2
"
size=
"md
"
class=
"loading-animation prepend-top-20 append-bottom-20"
/>
<geo-node-item
...
...
ee/spec/
javascripts
/geo_nodes/components/app_spec.js
→
ee/spec/
frontend
/geo_nodes/components/app_spec.js
View file @
e545a26f
...
...
@@ -5,7 +5,7 @@ import appComponent from 'ee/geo_nodes/components/app.vue';
import
eventHub
from
'
ee/geo_nodes/event_hub
'
;
import
GeoNodesStore
from
'
ee/geo_nodes/store/geo_nodes_store
'
;
import
GeoNodesService
from
'
ee/geo_nodes/service/geo_nodes_service
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
NODE_ACTIONS
}
from
'
ee/geo_nodes/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
...
...
@@ -16,6 +16,9 @@ import {
rawMockNodeDetails
,
}
from
'
../mock_data
'
;
jest
.
mock
(
'
~/smart_interval
'
);
jest
.
mock
(
'
ee/geo_nodes/event_hub
'
);
const
createComponent
=
()
=>
{
const
Component
=
Vue
.
extend
(
appComponent
);
const
store
=
new
GeoNodesStore
(
PRIMARY_VERSION
.
version
,
PRIMARY_VERSION
.
revision
);
...
...
@@ -97,7 +100,7 @@ describe('AppComponent', () => {
describe
(
'
fetchGeoNodes
'
,
()
=>
{
it
(
'
calls service.getGeoNodes and sets response to the store on success
'
,
done
=>
{
spyOn
(
vm
.
store
,
'
setNodes
'
);
jest
.
spyOn
(
vm
.
store
,
'
setNodes
'
);
vm
.
fetchGeoNodes
()
.
then
(()
=>
{
...
...
@@ -127,11 +130,9 @@ describe('AppComponent', () => {
describe
(
'
fetchNodeDetails
'
,
()
=>
{
it
(
'
calls service.getGeoNodeDetails and sets response to the store on success
'
,
done
=>
{
mock
.
onGet
(
mockNode
.
statusPath
).
reply
(
200
,
rawMockNodeDetails
);
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
();
vm
.
fetchNodeDetails
(
mockNode
)
.
then
(()
=>
{
expect
(
vm
.
service
.
getGeoNodeDetails
).
toHaveBeenCalled
();
expect
(
Object
.
keys
(
vm
.
store
.
state
.
nodeDetails
).
length
).
not
.
toBe
(
0
);
expect
(
vm
.
store
.
state
.
nodeDetails
[
'
1
'
]).
toBeDefined
();
})
...
...
@@ -140,9 +141,8 @@ describe('AppComponent', () => {
});
it
(
'
emits `nodeDetailsLoaded` event with fake nodeDetails object on 404 failure
'
,
done
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
mock
.
onGet
(
mockNode
.
statusPath
).
reply
(
404
,
{});
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
);
vm
.
fetchNodeDetails
(
mockNode
)
.
then
(()
=>
{
...
...
@@ -158,9 +158,8 @@ describe('AppComponent', () => {
});
it
(
'
emits `nodeDetailsLoaded` event with fake nodeDetails object when a network error occurs
'
,
done
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
mock
.
onGet
(
mockNode
.
statusPath
).
networkError
();
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
);
vm
.
fetchNodeDetails
(
mockNode
)
.
then
(()
=>
{
...
...
@@ -176,9 +175,8 @@ describe('AppComponent', () => {
});
it
(
'
emits `nodeDetailsLoaded` event with fake nodeDetails object when a timeout occurs
'
,
done
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
mock
.
onGet
(
mockNode
.
statusPath
).
timeout
();
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
getGeoNodeDetails
'
);
vm
.
fetchNodeDetails
(
mockNode
)
.
then
(()
=>
{
...
...
@@ -201,7 +199,7 @@ describe('AppComponent', () => {
expect
(
node
.
nodeActionActive
).
toBe
(
true
);
return
[
200
];
});
spyOn
(
vm
.
service
,
'
repairNode
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
repairNode
'
);
vm
.
repairNode
(
node
)
.
then
(()
=>
{
...
...
@@ -222,7 +220,7 @@ describe('AppComponent', () => {
expect
(
node
.
nodeActionActive
).
toBe
(
true
);
return
[
500
];
});
spyOn
(
vm
.
service
,
'
repairNode
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
repairNode
'
);
vm
.
repairNode
(
node
)
.
then
(()
=>
{
...
...
@@ -250,7 +248,7 @@ describe('AppComponent', () => {
},
];
});
spyOn
(
vm
.
service
,
'
toggleNode
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
toggleNode
'
);
node
.
enabled
=
false
;
vm
.
toggleNode
(
node
)
...
...
@@ -269,7 +267,7 @@ describe('AppComponent', () => {
expect
(
node
.
nodeActionActive
).
toBe
(
true
);
return
[
500
];
});
spyOn
(
vm
.
service
,
'
toggleNode
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
.
service
,
'
toggleNode
'
);
node
.
enabled
=
false
;
vm
.
toggleNode
(
node
)
...
...
@@ -293,8 +291,8 @@ describe('AppComponent', () => {
expect
(
node
.
nodeActionActive
).
toBe
(
true
);
return
[
200
];
});
spyOn
(
vm
.
service
,
'
removeNode
'
).
and
.
callThrough
(
);
spyOn
(
vm
.
store
,
'
removeNode
'
).
and
.
stub
(
);
jest
.
spyOn
(
vm
.
service
,
'
removeNode
'
);
jest
.
spyOn
(
vm
.
store
,
'
removeNode
'
);
vm
.
removeNode
(
node
)
.
then
(()
=>
{
...
...
@@ -314,8 +312,8 @@ describe('AppComponent', () => {
expect
(
node
.
nodeActionActive
).
toBe
(
true
);
return
[
500
];
});
spyOn
(
vm
.
service
,
'
removeNode
'
).
and
.
callThrough
(
);
spyOn
(
vm
.
store
,
'
removeNode
'
).
and
.
stub
(
);
jest
.
spyOn
(
vm
.
service
,
'
removeNode
'
);
jest
.
spyOn
(
vm
.
store
,
'
removeNode
'
);
vm
.
removeNode
(
node
)
.
then
(()
=>
{
...
...
@@ -334,8 +332,8 @@ describe('AppComponent', () => {
it
(
'
calls `toggleNode` and `hideNodeActionModal` when `targetNodeActionType` is `toggle`
'
,
()
=>
{
vm
.
targetNode
=
{
...
mockNode
};
vm
.
targetNodeActionType
=
NODE_ACTIONS
.
TOGGLE
;
spyOn
(
vm
,
'
hideNodeActionModal
'
);
spyOn
(
vm
,
'
toggleNode
'
).
and
.
stub
(
);
jest
.
spyOn
(
vm
,
'
hideNodeActionModal
'
);
jest
.
spyOn
(
vm
,
'
toggleNode
'
);
vm
.
handleNodeAction
();
...
...
@@ -346,8 +344,8 @@ describe('AppComponent', () => {
it
(
'
calls `removeNode` and `hideNodeActionModal` when `targetNodeActionType` is `remove`
'
,
()
=>
{
vm
.
targetNode
=
{
...
mockNode
};
vm
.
targetNodeActionType
=
NODE_ACTIONS
.
REMOVE
;
spyOn
(
vm
,
'
hideNodeActionModal
'
);
spyOn
(
vm
,
'
removeNode
'
).
and
.
stub
(
);
jest
.
spyOn
(
vm
,
'
hideNodeActionModal
'
);
jest
.
spyOn
(
vm
,
'
removeNode
'
);
vm
.
handleNodeAction
();
...
...
@@ -370,7 +368,7 @@ describe('AppComponent', () => {
modalMessage
=
'
Foobar message
'
;
modalActionLabel
=
'
Disable
'
;
modalTitle
=
'
Test title
'
;
rootEmit
=
spyOn
(
vm
.
$root
,
'
$emit
'
);
rootEmit
=
jest
.
spyOn
(
vm
.
$root
,
'
$emit
'
);
});
it
(
'
sets target node and modal config props on component
'
,
()
=>
{
...
...
@@ -407,7 +405,7 @@ describe('AppComponent', () => {
it
(
'
calls toggleNode when actionType is `toggle` and node.enabled is `false`
'
,
()
=>
{
node
.
enabled
=
false
;
spyOn
(
vm
,
'
toggleNode
'
).
and
.
stub
(
);
jest
.
spyOn
(
vm
,
'
toggleNode
'
);
vm
.
showNodeActionModal
({
actionType
:
NODE_ACTIONS
.
TOGGLE
,
...
...
@@ -437,7 +435,7 @@ describe('AppComponent', () => {
describe
(
'
hideNodeActionModal
'
,
()
=>
{
it
(
'
emits `bv::hide::modal`
'
,
()
=>
{
const
rootEmit
=
spyOn
(
vm
.
$root
,
'
$emit
'
);
const
rootEmit
=
jest
.
spyOn
(
vm
.
$root
,
'
$emit
'
);
vm
.
hideNodeActionModal
();
expect
(
rootEmit
).
toHaveBeenCalledWith
(
'
bv::hide::modal
'
,
vm
.
modalId
);
...
...
@@ -447,7 +445,6 @@ describe('AppComponent', () => {
describe
(
'
created
'
,
()
=>
{
it
(
'
binds event handler for `pollNodeDetails`
'
,
()
=>
{
spyOn
(
eventHub
,
'
$on
'
);
const
vmX
=
createComponent
();
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
'
pollNodeDetails
'
,
jasmine
.
any
(
Function
));
...
...
@@ -459,7 +456,6 @@ describe('AppComponent', () => {
describe
(
'
beforeDestroy
'
,
()
=>
{
it
(
'
unbinds event handler for `pollNodeDetails`
'
,
()
=>
{
spyOn
(
eventHub
,
'
$off
'
);
const
vmX
=
createComponent
();
vmX
.
$destroy
();
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_actions_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_actions_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
geoNodeActionsComponent
from
'
ee/geo_nodes/components/geo_node_actions.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
eventHub
from
'
ee/geo_nodes/event_hub
'
;
import
{
NODE_ACTIONS
}
from
'
ee/geo_nodes/constants
'
;
import
{
mockNodes
}
from
'
../mock_data
'
;
jest
.
mock
(
'
ee/geo_nodes/event_hub
'
);
const
createComponent
=
(
node
=
mockNodes
[
0
],
nodeEditAllowed
=
true
,
...
...
@@ -68,7 +70,6 @@ describe('GeoNodeActionsComponent', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
onToggleNode
'
,
()
=>
{
it
(
'
emits showNodeActionModal with actionType `toggle`, node reference, modalMessage, modalActionLabel, and modalTitle
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
onToggleNode
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
showNodeActionModal
'
,
{
...
...
@@ -83,7 +84,6 @@ describe('GeoNodeActionsComponent', () => {
describe
(
'
onRemovePrimaryNode
'
,
()
=>
{
it
(
'
emits showNodeActionModal with actionType `remove`, node reference, modalKind, modalMessage, modalActionLabel, and modalTitle
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
onRemovePrimaryNode
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
showNodeActionModal
'
,
{
...
...
@@ -100,7 +100,6 @@ describe('GeoNodeActionsComponent', () => {
describe
(
'
onRemoveSecondaryNode
'
,
()
=>
{
it
(
'
emits showNodeActionModal with actionType `remove`, node reference, modalKind, modalMessage, modalActionLabel, and modalTitle
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
onRemoveSecondaryNode
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
showNodeActionModal
'
,
{
...
...
@@ -117,7 +116,6 @@ describe('GeoNodeActionsComponent', () => {
describe
(
'
onRepairNode
'
,
()
=>
{
it
(
'
emits `repairNode` event with node reference
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
onRepairNode
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
repairNode
'
,
vm
.
node
);
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_detail_item_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_detail_item_spec.js
View file @
e545a26f
...
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
geoNodeDetailItemComponent
from
'
ee/geo_nodes/components/geo_node_detail_item.vue
'
;
import
{
VALUE_TYPE
,
CUSTOM_TYPE
}
from
'
ee/geo_nodes/constants
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
rawMockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
config
=>
{
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_details_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_details_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
geoNodeDetailsComponent
from
'
ee/geo_nodes/components/geo_node_details.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
({
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_event_status_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_event_status_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
geoNodeEventStatusComponent
from
'
ee/geo_nodes/components/geo_node_event_status.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
({
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_header_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_header_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
GeoNodeHeaderComponent
from
'
ee/geo_nodes/components/geo_node_header.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
({
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_health_status_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_health_status_spec.js
View file @
e545a26f
...
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
geoNodeHealthStatusComponent
from
'
ee/geo_nodes/components/geo_node_health_status.vue
'
;
import
{
HEALTH_STATUS_ICON
,
HEALTH_STATUS_CLASS
}
from
'
ee/geo_nodes/constants
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
(
status
=
mockNodeDetails
.
health
)
=>
{
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_item_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_item_spec.js
View file @
e545a26f
...
...
@@ -2,9 +2,11 @@ import Vue from 'vue';
import
geoNodeItemComponent
from
'
ee/geo_nodes/components/geo_node_item.vue
'
;
import
eventHub
from
'
ee/geo_nodes/event_hub
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
../mock_data
'
;
jest
.
mock
(
'
ee/geo_nodes/event_hub
'
);
const
createComponent
=
(
node
=
mockNode
)
=>
{
const
Component
=
Vue
.
extend
(
geoNodeItemComponent
);
...
...
@@ -45,6 +47,7 @@ describe('GeoNodeItemComponent', () => {
beforeEach
(()
=>
{
// Altered mock data for secure URL
httpsNode
=
Object
.
assign
({},
mockNode
,
{
id
:
mockNodeDetails
.
id
,
url
:
'
https://127.0.0.1:3001/
'
,
});
vmHttps
=
createComponent
(
httpsNode
);
...
...
@@ -56,23 +59,24 @@ describe('GeoNodeItemComponent', () => {
describe
(
'
showNodeDetails
'
,
()
=>
{
it
(
'
returns `false` if Node details are still loading
'
,
()
=>
{
vm
.
isNodeDetailsLoading
=
true
;
vm
Https
.
isNodeDetailsLoading
=
true
;
expect
(
vm
.
showNodeDetails
).
toBeFalsy
();
expect
(
vm
Https
.
showNodeDetails
).
toBeFalsy
();
});
it
(
'
returns `false` if Node details failed to load
'
,
()
=>
{
vm
.
isNodeDetailsLoading
=
false
;
vm
.
isNodeDetailsFailed
=
true
;
vm
Https
.
isNodeDetailsLoading
=
false
;
vm
Https
.
isNodeDetailsFailed
=
true
;
expect
(
vm
.
showNodeDetails
).
toBeFalsy
();
expect
(
vm
Https
.
showNodeDetails
).
toBeFalsy
();
});
it
(
'
returns `true` if Node details loaded
'
,
()
=>
{
vm
.
isNodeDetailsLoading
=
false
;
vm
.
isNodeDetailsFailed
=
false
;
vmHttps
.
handleNodeDetails
(
mockNodeDetails
);
vmHttps
.
isNodeDetailsLoading
=
false
;
vmHttps
.
isNodeDetailsFailed
=
false
;
expect
(
vm
.
showNodeDetails
).
toBeTruthy
();
expect
(
vm
Https
.
showNodeDetails
).
toBeTruthy
();
});
});
});
...
...
@@ -107,8 +111,6 @@ describe('GeoNodeItemComponent', () => {
describe
(
'
handleMounted
'
,
()
=>
{
it
(
'
emits `pollNodeDetails` event and passes node ID
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
handleMounted
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
pollNodeDetails
'
,
vm
.
node
);
...
...
@@ -118,8 +120,6 @@ describe('GeoNodeItemComponent', () => {
describe
(
'
created
'
,
()
=>
{
it
(
'
binds `nodeDetailsLoaded` event handler
'
,
()
=>
{
spyOn
(
eventHub
,
'
$on
'
);
const
vmX
=
createComponent
();
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
'
nodeDetailsLoaded
'
,
jasmine
.
any
(
Function
));
...
...
@@ -129,8 +129,6 @@ describe('GeoNodeItemComponent', () => {
describe
(
'
beforeDestroy
'
,
()
=>
{
it
(
'
unbinds `nodeDetailsLoaded` event handler
'
,
()
=>
{
spyOn
(
eventHub
,
'
$off
'
);
const
vmX
=
createComponent
();
vmX
.
$destroy
();
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_node_sync_settings_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_node_sync_settings_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
geoNodeSyncSettingsComponent
from
'
ee/geo_nodes/components/geo_node_sync_settings.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
(
...
...
ee/spec/
javascripts
/geo_nodes/components/geo_nodes_list_spec.js
→
ee/spec/
frontend
/geo_nodes/components/geo_nodes_list_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
geoNodesListComponent
from
'
ee/geo_nodes/components/geo_nodes_list.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodes
}
from
'
../mock_data
'
;
const
createComponent
=
()
=>
{
...
...
ee/spec/
javascripts
/geo_nodes/components/node_detail_sections/node_details_section_main_spec.js
→
ee/spec/
frontend
/geo_nodes/components/node_detail_sections/node_details_section_main_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
NodeDetailsSectionMainComponent
from
'
ee/geo_nodes/components/node_detail_sections/node_details_section_main.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
ee_spec/geo_nodes
/mock_data
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
../..
/mock_data
'
;
const
MOCK_VERSION_TEXT
=
`
${
mockNodeDetails
.
version
}
(
${
mockNodeDetails
.
revision
}
)`
;
...
...
ee/spec/
javascripts
/geo_nodes/components/node_detail_sections/node_details_section_other_spec.js
→
ee/spec/
frontend
/geo_nodes/components/node_detail_sections/node_details_section_other_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
NodeDetailsSectionOtherComponent
from
'
ee/geo_nodes/components/node_detail_sections/node_details_section_other.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
ee_spec/geo_nodes
/mock_data
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNode
,
mockNodeDetails
}
from
'
../..
/mock_data
'
;
import
{
numberToHumanSize
}
from
'
~/lib/utils/number_utils
'
;
const
createComponent
=
(
...
...
ee/spec/
javascripts
/geo_nodes/components/node_detail_sections/node_details_section_sync_spec.js
→
ee/spec/
frontend
/geo_nodes/components/node_detail_sections/node_details_section_sync_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
NodeDetailsSectionSyncComponent
from
'
ee/geo_nodes/components/node_detail_sections/node_details_section_sync.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
ee_spec/geo_nodes
/mock_data
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../..
/mock_data
'
;
const
createComponent
=
(
nodeDetails
=
Object
.
assign
({},
mockNodeDetails
))
=>
{
const
Component
=
Vue
.
extend
(
NodeDetailsSectionSyncComponent
);
...
...
ee/spec/
javascripts
/geo_nodes/components/node_detail_sections/node_details_section_verification_spec.js
→
ee/spec/
frontend
/geo_nodes/components/node_detail_sections/node_details_section_verification_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
NodeDetailsSectionVerificationComponent
from
'
ee/geo_nodes/components/node_detail_sections/node_details_section_verification.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
ee_spec/geo_nodes
/mock_data
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../..
/mock_data
'
;
const
createComponent
=
({
nodeDetails
=
mockNodeDetails
,
nodeTypePrimary
=
false
})
=>
{
const
Component
=
Vue
.
extend
(
NodeDetailsSectionVerificationComponent
);
...
...
ee/spec/
javascripts
/geo_nodes/components/node_detail_sections/section_reveal_button_spec.js
→
ee/spec/
frontend
/geo_nodes/components/node_detail_sections/section_reveal_button_spec.js
View file @
e545a26f
import
Vue
from
'
vue
'
;
import
SectionRevealButtonComponent
from
'
ee/geo_nodes/components/node_detail_sections/section_reveal_button.vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
const
createComponent
=
(
buttonTitle
=
'
Foo button
'
)
=>
{
const
Component
=
Vue
.
extend
(
SectionRevealButtonComponent
);
...
...
@@ -52,7 +52,7 @@ describe('SectionRevealButton', () => {
});
it
(
'
emits `toggleButton` event on component
'
,
()
=>
{
spyOn
(
vm
,
'
$emit
'
);
jest
.
spyOn
(
vm
,
'
$emit
'
);
vm
.
onClickButton
();
expect
(
vm
.
$emit
).
toHaveBeenCalledWith
(
'
toggleButton
'
,
vm
.
toggleState
);
...
...
ee/spec/
javascripts
/geo_nodes/mixins/details_section_mixin_spec.js
→
ee/spec/
frontend
/geo_nodes/mixins/details_section_mixin_spec.js
View file @
e545a26f
...
...
@@ -3,7 +3,7 @@ import Vue from 'vue';
import
DetailsSectionMixin
from
'
ee/geo_nodes/mixins/details_section_mixin
'
;
import
{
STATUS_DELAY_THRESHOLD_MS
}
from
'
ee/geo_nodes/constants
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../mock_data
'
;
const
createComponent
=
(
nodeDetails
=
mockNodeDetails
)
=>
{
...
...
@@ -12,7 +12,9 @@ const createComponent = (nodeDetails = mockNodeDetails) => {
data
()
{
return
{
nodeDetails
};
},
template
:
'
<div></div>
'
,
render
(
h
)
{
return
h
(
'
div
'
);
},
});
return
mountComponent
(
Component
);
...
...
ee/spec/
javascripts
/geo_nodes/mock_data.js
→
ee/spec/
frontend
/geo_nodes/mock_data.js
View file @
e545a26f
File moved
ee/spec/
javascripts
/geo_nodes/service/geo_nodes_service_spec.js
→
ee/spec/
frontend
/geo_nodes/service/geo_nodes_service_spec.js
View file @
e545a26f
...
...
@@ -3,6 +3,8 @@ import axios from '~/lib/utils/axios_utils';
import
{
NODE_DETAILS_PATH
}
from
'
../mock_data
'
;
jest
.
mock
(
'
axios
'
);
describe
(
'
GeoNodesService
'
,
()
=>
{
let
service
;
...
...
@@ -12,7 +14,6 @@ describe('GeoNodesService', () => {
describe
(
'
getGeoNodes
'
,
()
=>
{
it
(
'
returns axios instance for Geo nodes path
'
,
()
=>
{
spyOn
(
axios
,
'
get
'
).
and
.
stub
();
service
.
getGeoNodes
();
expect
(
axios
.
get
).
toHaveBeenCalledWith
(
service
.
geoNodesPath
);
...
...
@@ -21,7 +22,6 @@ describe('GeoNodesService', () => {
describe
(
'
getGeoNodeDetails
'
,
()
=>
{
it
(
'
returns axios instance for Geo node details path
'
,
()
=>
{
spyOn
(
axios
,
'
get
'
).
and
.
stub
();
service
.
getGeoNodeDetails
(
2
);
expect
(
axios
.
get
).
toHaveBeenCalled
();
...
...
ee/spec/
javascripts
/geo_nodes/store/geo_nodes_store_spec.js
→
ee/spec/
frontend
/geo_nodes/store/geo_nodes_store_spec.js
View file @
e545a26f
File moved
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