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
8aaa3ccb
Commit
8aaa3ccb
authored
Mar 23, 2021
by
Vitaly Slobodin
Committed by
Savas Vedova
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate nav_controls_spec to VTU
parent
e3b9cced
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
spec/frontend/pipelines/nav_controls_spec.js
spec/frontend/pipelines/nav_controls_spec.js
+30
-30
No files found.
spec/frontend/pipelines/nav_controls_spec.js
View file @
8aaa3ccb
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
{
nextTick
}
from
'
vue
'
;
import
navControlsComp
from
'
~/pipelines/components/pipelines_list/nav_controls.vue
'
;
import
NavControls
from
'
~/pipelines/components/pipelines_list/nav_controls.vue
'
;
describe
(
'
Pipelines Nav Controls
'
,
()
=>
{
describe
(
'
Pipelines Nav Controls
'
,
()
=>
{
let
NavControlsComponent
;
let
wrapper
;
let
component
;
beforeEach
(()
=>
{
const
createComponent
=
(
props
)
=>
{
NavControlsComponent
=
Vue
.
extend
(
navControlsComp
);
wrapper
=
shallowMount
(
NavControls
,
{
propsData
:
{
...
props
,
},
});
});
};
const
findRunPipeline
=
()
=>
wrapper
.
find
(
'
.js-run-pipeline
'
);
afterEach
(()
=>
{
afterEach
(()
=>
{
component
.
$
destroy
();
wrapper
.
destroy
();
});
});
it
(
'
should render link to create a new pipeline
'
,
()
=>
{
it
(
'
should render link to create a new pipeline
'
,
()
=>
{
...
@@ -21,12 +26,11 @@ describe('Pipelines Nav Controls', () => {
...
@@ -21,12 +26,11 @@ describe('Pipelines Nav Controls', () => {
resetCachePath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
};
};
c
omponent
=
mountComponent
(
NavControlsComponent
,
mockData
);
c
reateComponent
(
mockData
);
expect
(
component
.
$el
.
querySelector
(
'
.js-run-pipeline
'
).
textContent
).
toContain
(
'
Run Pipeline
'
);
const
runPipeline
=
findRunPipeline
();
expect
(
component
.
$el
.
querySelector
(
'
.js-run-pipeline
'
).
getAttribute
(
'
href
'
)).
toEqual
(
expect
(
runPipeline
.
text
()).
toContain
(
'
Run Pipeline
'
);
mockData
.
newPipelinePath
,
expect
(
runPipeline
.
attributes
(
'
href
'
)).
toBe
(
mockData
.
newPipelinePath
);
);
});
});
it
(
'
should not render link to create pipeline if no path is provided
'
,
()
=>
{
it
(
'
should not render link to create pipeline if no path is provided
'
,
()
=>
{
...
@@ -36,9 +40,9 @@ describe('Pipelines Nav Controls', () => {
...
@@ -36,9 +40,9 @@ describe('Pipelines Nav Controls', () => {
resetCachePath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
};
};
c
omponent
=
mountComponent
(
NavControlsComponent
,
mockData
);
c
reateComponent
(
mockData
);
expect
(
component
.
$el
.
querySelector
(
'
.js-run-pipeline
'
)).
toEqual
(
null
);
expect
(
findRunPipeline
().
exists
()).
toBe
(
false
);
});
});
it
(
'
should render link for CI lint
'
,
()
=>
{
it
(
'
should render link for CI lint
'
,
()
=>
{
...
@@ -49,12 +53,10 @@ describe('Pipelines Nav Controls', () => {
...
@@ -49,12 +53,10 @@ describe('Pipelines Nav Controls', () => {
resetCachePath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
};
};
c
omponent
=
mountComponent
(
NavControlsComponent
,
mockData
);
c
reateComponent
(
mockData
);
expect
(
component
.
$el
.
querySelector
(
'
.js-ci-lint
'
).
textContent
.
trim
()).
toContain
(
'
CI Lint
'
);
expect
(
wrapper
.
find
(
'
.js-ci-lint
'
).
text
().
trim
()).
toContain
(
'
CI Lint
'
);
expect
(
component
.
$el
.
querySelector
(
'
.js-ci-lint
'
).
getAttribute
(
'
href
'
)).
toEqual
(
expect
(
wrapper
.
find
(
'
.js-ci-lint
'
).
attributes
(
'
href
'
)).
toBe
(
mockData
.
ciLintPath
);
mockData
.
ciLintPath
,
);
});
});
describe
(
'
Reset Runners Cache
'
,
()
=>
{
describe
(
'
Reset Runners Cache
'
,
()
=>
{
...
@@ -64,22 +66,20 @@ describe('Pipelines Nav Controls', () => {
...
@@ -64,22 +66,20 @@ describe('Pipelines Nav Controls', () => {
ciLintPath
:
'
foo
'
,
ciLintPath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
resetCachePath
:
'
foo
'
,
};
};
createComponent
(
mockData
);
component
=
mountComponent
(
NavControlsComponent
,
mockData
);
});
});
it
(
'
should render button for resetting runner caches
'
,
()
=>
{
it
(
'
should render button for resetting runner caches
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.js-clear-cache
'
).
textContent
.
trim
()).
toContain
(
expect
(
wrapper
.
find
(
'
.js-clear-cache
'
).
text
().
trim
()).
toContain
(
'
Clear Runner Caches
'
);
'
Clear Runner Caches
'
,
);
});
});
it
(
'
should emit postAction event when reset runner cache button is clicked
'
,
()
=>
{
it
(
'
should emit postAction event when reset runner cache button is clicked
'
,
async
()
=>
{
jest
.
spyOn
(
component
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
$emit
'
).
mockImplementation
(()
=>
{});
component
.
$el
.
querySelector
(
'
.js-clear-cache
'
).
click
();
wrapper
.
find
(
'
.js-clear-cache
'
).
vm
.
$emit
(
'
click
'
);
await
nextTick
();
expect
(
component
.
$emit
).
toHaveBeenCalledWith
(
'
resetRunnersCache
'
,
'
foo
'
);
expect
(
wrapper
.
vm
.
$emit
).
toHaveBeenCalledWith
(
'
resetRunnersCache
'
,
'
foo
'
);
});
});
});
});
});
});
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