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
e9da4323
Commit
e9da4323
authored
Dec 23, 2020
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecated `methods` in various `ee` specs
Replace stubbing methods with store mocks
parent
4ab9b3ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
29 deletions
+20
-29
ee/spec/frontend/sidebar/components/status/sidebar_status_spec.js
...frontend/sidebar/components/status/sidebar_status_spec.js
+15
-25
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
...hared/metrics_reports/grouped_metrics_reports_app_spec.js
+5
-4
No files found.
ee/spec/frontend/sidebar/components/status/sidebar_status_spec.js
View file @
e9da4323
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
SidebarStatus
from
'
ee/sidebar/components/status/sidebar_status.vue
'
;
import
SidebarStatus
from
'
ee/sidebar/components/status/sidebar_status.vue
'
;
import
Status
from
'
ee/sidebar/components/status/status.vue
'
;
import
Status
from
'
ee/sidebar/components/status/status.vue
'
;
Vue
.
use
(
Vuex
);
describe
(
'
SidebarStatus
'
,
()
=>
{
describe
(
'
SidebarStatus
'
,
()
=>
{
let
mediator
;
let
mediator
;
let
wrapper
;
let
wrapper
;
let
handleDropdownClickMock
;
const
createMediator
=
states
=>
{
const
createMediator
=
states
=>
{
mediator
=
{
mediator
=
{
updateStatus
:
jest
.
fn
().
mockResolvedValue
(),
store
:
{
store
:
{
isFetching
:
{
isFetching
:
{
status
:
true
,
status
:
true
,
...
@@ -19,22 +23,21 @@ describe('SidebarStatus', () => {
...
@@ -19,22 +23,21 @@ describe('SidebarStatus', () => {
};
};
};
};
const
createWrapper
=
(
mockStore
=
{})
=>
{
const
createWrapper
=
({
noteableState
}
=
{})
=>
{
const
store
=
new
Vuex
.
Store
({
getters
:
{
getNoteableData
:
()
=>
({
state
:
noteableState
}),
},
});
wrapper
=
shallowMount
(
SidebarStatus
,
{
wrapper
=
shallowMount
(
SidebarStatus
,
{
propsData
:
{
propsData
:
{
mediator
,
mediator
,
},
},
methods
:
{
store
,
handleDropdownClick
:
handleDropdownClickMock
,
},
mocks
:
{
$store
:
mockStore
,
},
});
});
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
handleDropdownClickMock
=
jest
.
fn
();
createMediator
();
createMediator
();
createWrapper
();
createWrapper
();
});
});
...
@@ -52,15 +55,8 @@ describe('SidebarStatus', () => {
...
@@ -52,15 +55,8 @@ describe('SidebarStatus', () => {
${
'
closed
'
}
|
${
false
}
${
'
closed
'
}
|
${
false
}
`
(
'
isOpen
'
,
({
noteableState
,
isOpen
})
=>
{
`
(
'
isOpen
'
,
({
noteableState
,
isOpen
})
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
mockStore
=
{
getters
:
{
getNoteableData
:
{
state
:
noteableState
,
},
},
};
createMediator
({
editable
:
true
});
createMediator
({
editable
:
true
});
createWrapper
(
mockStore
);
createWrapper
(
{
noteableState
}
);
});
});
it
(
`returns
${
isOpen
}
when issue is
${
noteableState
}
`
,
()
=>
{
it
(
`returns
${
isOpen
}
when issue is
${
noteableState
}
`
,
()
=>
{
...
@@ -76,16 +72,10 @@ describe('SidebarStatus', () => {
...
@@ -76,16 +72,10 @@ describe('SidebarStatus', () => {
expect
(
wrapper
.
find
(
Status
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
Status
).
exists
()).
toBe
(
true
);
});
});
it
(
'
calls
handleFormSubmission
when receiving an onDropdownClick event from Status component
'
,
()
=>
{
it
(
'
calls
mediator status update
when receiving an onDropdownClick event from Status component
'
,
()
=>
{
wrapper
.
find
(
Status
).
vm
.
$emit
(
'
onDropdownClick
'
,
'
onTrack
'
);
wrapper
.
find
(
Status
).
vm
.
$emit
(
'
onDropdownClick
'
,
'
onTrack
'
);
expect
(
handleDropdownClickMock
).
toHaveBeenCalledWith
(
'
onTrack
'
);
expect
(
mediator
.
updateStatus
).
toHaveBeenCalledWith
(
'
onTrack
'
);
});
});
});
});
it
(
'
calls handleFormSubmission when receiving an onFormSubmit event from Status component
'
,
()
=>
{
wrapper
.
find
(
Status
).
vm
.
$emit
(
'
onDropdownClick
'
,
'
onTrack
'
);
expect
(
handleDropdownClickMock
).
toHaveBeenCalledWith
(
'
onTrack
'
);
});
});
});
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
View file @
e9da4323
...
@@ -18,14 +18,15 @@ describe('Grouped metrics reports app', () => {
...
@@ -18,14 +18,15 @@ describe('Grouped metrics reports app', () => {
propsData
:
{
propsData
:
{
endpoint
:
'
metrics.json
'
,
endpoint
:
'
metrics.json
'
,
},
},
methods
:
{
fetchMetrics
:
()
=>
{},
},
});
});
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mockStore
=
new
Vuex
.
Store
(
getStoreConfig
());
const
{
actions
,
...
storeConfig
}
=
getStoreConfig
();
mockStore
=
new
Vuex
.
Store
({
...
storeConfig
,
actions
:
{
...
actions
,
fetchMetrics
:
()
=>
({})
},
});
mountComponent
();
mountComponent
();
});
});
...
...
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