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
f4d58dcc
Commit
f4d58dcc
authored
Nov 08, 2018
by
Adriel Santiago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix transient dashboard spec failure
parent
6caf7512
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
ee/spec/javascripts/operations/components/dashboard/dashboard_spec.js
...scripts/operations/components/dashboard/dashboard_spec.js
+12
-18
No files found.
ee/spec/javascripts/operations/components/dashboard/dashboard_spec.js
View file @
f4d58dcc
import
Vue
from
'
vue
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
store
from
'
ee/operations/store/index
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
Dashboard
from
'
ee/operations/components/dashboard/dashboard.vue
'
;
import
ProjectSearch
from
'
ee/operations/components/dashboard/project_search.vue
'
;
import
DashboardProject
from
'
ee/operations/components/dashboard/project.vue
'
;
...
...
@@ -14,29 +11,28 @@ describe('dashboard component', () => {
const
ProjectSearchComponent
=
Vue
.
extend
(
ProjectSearch
);
const
DashboardProjectComponent
=
Vue
.
extend
(
DashboardProject
);
const
projectTokens
=
mockProjectData
(
1
);
const
mockListPath
=
'
mock-listPath
'
;
const
mount
=
()
=>
mountComponentWithStore
(
DashboardComponent
,
{
new
DashboardComponent
(
{
store
,
props
:
{
props
Data
:
{
addPath
:
'
mock-addPath
'
,
listPath
:
mockListPath
,
listPath
:
'
mock-listPath
'
,
emptyDashboardSvgPath
:
'
/assets/illustrations/operations-dashboard_empty.svg
'
,
emptyDashboardHelpPath
:
'
/help/user/operations_dashboard/index.html
'
,
},
});
methods
:
{
fetchProjects
:
()
=>
{},
},
}).
$mount
();
let
vm
;
let
mockAxios
;
beforeEach
(()
=>
{
vm
=
mount
();
mockAxios
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
clearState
(
store
);
mockAxios
.
restore
();
});
it
(
'
renders dashboard title
'
,
()
=>
{
...
...
@@ -57,7 +53,7 @@ describe('dashboard component', () => {
});
it
(
'
calls action to add projects on click if projectTokens have been added
'
,
()
=>
{
const
spy
=
spyOn
(
vm
,
'
addProjectsToDashboard
'
);
const
spy
=
spyOn
(
vm
,
'
addProjectsToDashboard
'
)
.
and
.
stub
()
;
vm
.
$store
.
state
.
projectTokens
=
projectTokens
;
button
.
click
();
...
...
@@ -65,7 +61,7 @@ describe('dashboard component', () => {
});
it
(
'
does not call action to add projects on click when projectTokens is empty
'
,
()
=>
{
const
spy
=
spyOn
(
vm
,
'
addProjectsToDashboard
'
);
const
spy
=
spyOn
(
vm
,
'
addProjectsToDashboard
'
)
.
and
.
stub
()
;
button
.
click
();
expect
(
spy
).
not
.
toHaveBeenCalled
();
...
...
@@ -102,16 +98,14 @@ describe('dashboard component', () => {
describe
(
'
empty state
'
,
()
=>
{
beforeEach
(()
=>
{
mockAxios
.
onGet
(
mockListPath
).
replyOnce
(
200
,
{
data
:
[]
})
;
store
.
state
.
projects
=
[]
;
vm
=
mount
();
});
it
(
'
renders empty state svg after requesting projects with no results
'
,
()
=>
{
const
svgSrc
=
vm
.
$el
.
querySelector
(
'
.js-empty-state-svg
'
)
.
src
.
slice
(
-
mockText
.
EMPTY_SVG_SOURCE
.
length
);
const
svgSrc
=
vm
.
$el
.
querySelector
(
'
.js-empty-state-svg
'
).
src
;
expect
(
svgSrc
).
to
Be
(
mockText
.
EMPTY_SVG_SOURCE
);
expect
(
svgSrc
).
to
Match
(
mockText
.
EMPTY_SVG_SOURCE
);
});
it
(
'
renders title
'
,
()
=>
{
...
...
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