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
2a388005
Commit
2a388005
authored
Apr 30, 2020
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate pipeline table spec
Migrate pipeline table spec from karma to jest.
parent
e70ff61f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
86 deletions
+65
-86
spec/frontend/pipelines/pipelines_table_spec.js
spec/frontend/pipelines/pipelines_table_spec.js
+65
-0
spec/javascripts/pipelines/pipelines_table_spec.js
spec/javascripts/pipelines/pipelines_table_spec.js
+0
-86
No files found.
spec/frontend/pipelines/pipelines_table_spec.js
0 → 100644
View file @
2a388005
import
{
mount
}
from
'
@vue/test-utils
'
;
import
PipelinesTable
from
'
~/pipelines/components/pipelines_table.vue
'
;
describe
(
'
Pipelines Table
'
,
()
=>
{
let
pipeline
;
let
wrapper
;
const
jsonFixtureName
=
'
pipelines/pipelines.json
'
;
const
defaultProps
=
{
pipelines
:
[],
autoDevopsHelpPath
:
'
foo
'
,
viewType
:
'
root
'
,
};
const
createComponent
=
(
props
=
defaultProps
)
=>
{
wrapper
=
mount
(
PipelinesTable
,
{
propsData
:
props
,
});
};
preloadFixtures
(
jsonFixtureName
);
beforeEach
(()
=>
{
const
{
pipelines
}
=
getJSONFixture
(
jsonFixtureName
);
pipeline
=
pipelines
.
find
(
p
=>
p
.
user
!==
null
&&
p
.
commit
!==
null
);
createComponent
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
table
'
,
()
=>
{
it
(
'
should render a table
'
,
()
=>
{
expect
(
wrapper
.
attributes
(
'
class
'
)).
toContain
(
'
ci-table
'
);
});
it
(
'
should render table head with correct columns
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.table-section.js-pipeline-status
'
).
text
()).
toEqual
(
'
Status
'
);
expect
(
wrapper
.
find
(
'
.table-section.js-pipeline-info
'
).
text
()).
toEqual
(
'
Pipeline
'
);
expect
(
wrapper
.
find
(
'
.table-section.js-pipeline-commit
'
).
text
()).
toEqual
(
'
Commit
'
);
expect
(
wrapper
.
find
(
'
.table-section.js-pipeline-stages
'
).
text
()).
toEqual
(
'
Stages
'
);
});
});
describe
(
'
without data
'
,
()
=>
{
it
(
'
should render an empty table
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.commit.gl-responsive-table-row
'
).
exists
()).
toBe
(
false
);
});
});
describe
(
'
with data
'
,
()
=>
{
it
(
'
should render rows
'
,
()
=>
{
createComponent
({
pipelines
:
[
pipeline
],
autoDevopsHelpPath
:
'
foo
'
,
viewType
:
'
root
'
});
expect
(
wrapper
.
findAll
(
'
.commit.gl-responsive-table-row
'
)).
toHaveLength
(
1
);
});
});
});
spec/javascripts/pipelines/pipelines_table_spec.js
deleted
100644 → 0
View file @
e70ff61f
import
Vue
from
'
vue
'
;
import
pipelinesTableComp
from
'
~/pipelines/components/pipelines_table.vue
'
;
import
'
~/lib/utils/datetime_utility
'
;
describe
(
'
Pipelines Table
'
,
()
=>
{
const
jsonFixtureName
=
'
pipelines/pipelines.json
'
;
let
pipeline
;
let
PipelinesTableComponent
;
preloadFixtures
(
jsonFixtureName
);
beforeEach
(()
=>
{
const
{
pipelines
}
=
getJSONFixture
(
jsonFixtureName
);
PipelinesTableComponent
=
Vue
.
extend
(
pipelinesTableComp
);
pipeline
=
pipelines
.
find
(
p
=>
p
.
user
!==
null
&&
p
.
commit
!==
null
);
});
describe
(
'
table
'
,
()
=>
{
let
component
;
beforeEach
(()
=>
{
component
=
new
PipelinesTableComponent
({
propsData
:
{
pipelines
:
[],
autoDevopsHelpPath
:
'
foo
'
,
viewType
:
'
root
'
,
},
}).
$mount
();
});
afterEach
(()
=>
{
component
.
$destroy
();
});
it
(
'
should render a table
'
,
()
=>
{
expect
(
component
.
$el
.
getAttribute
(
'
class
'
)).
toContain
(
'
ci-table
'
);
});
it
(
'
should render table head with correct columns
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.table-section.js-pipeline-status
'
).
textContent
.
trim
(),
).
toEqual
(
'
Status
'
);
expect
(
component
.
$el
.
querySelector
(
'
.table-section.js-pipeline-info
'
).
textContent
.
trim
(),
).
toEqual
(
'
Pipeline
'
);
expect
(
component
.
$el
.
querySelector
(
'
.table-section.js-pipeline-commit
'
).
textContent
.
trim
(),
).
toEqual
(
'
Commit
'
);
expect
(
component
.
$el
.
querySelector
(
'
.table-section.js-pipeline-stages
'
).
textContent
.
trim
(),
).
toEqual
(
'
Stages
'
);
});
});
describe
(
'
without data
'
,
()
=>
{
it
(
'
should render an empty table
'
,
()
=>
{
const
component
=
new
PipelinesTableComponent
({
propsData
:
{
pipelines
:
[],
autoDevopsHelpPath
:
'
foo
'
,
viewType
:
'
root
'
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelectorAll
(
'
.commit.gl-responsive-table-row
'
).
length
).
toEqual
(
0
);
});
});
describe
(
'
with data
'
,
()
=>
{
it
(
'
should render rows
'
,
()
=>
{
const
component
=
new
PipelinesTableComponent
({
propsData
:
{
pipelines
:
[
pipeline
],
autoDevopsHelpPath
:
'
foo
'
,
viewType
:
'
root
'
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelectorAll
(
'
.commit.gl-responsive-table-row
'
).
length
).
toEqual
(
1
);
});
});
});
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