Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
c425a837
Commit
c425a837
authored
Jan 27, 2020
by
Lukas Siatka
Committed by
Lukas Siatka
Jan 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: adds basic tests to TableContainer checking the render and output on 0 series returned
parent
f7fe4d48
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
public/app/features/explore/TableContainer.test.tsx
+42
-0
public/app/features/explore/__snapshots__/TableContainer.test.tsx.snap
+21
-0
No files found.
public/app/features/explore/TableContainer.test.tsx
0 → 100644
View file @
c425a837
import
React
from
'react'
;
import
{
shallow
,
render
}
from
'enzyme'
;
import
{
TableContainer
}
from
'./TableContainer'
;
import
{
DataFrame
}
from
'@grafana/data'
;
import
{
toggleTable
}
from
'./state/actions'
;
import
{
ExploreId
}
from
'app/types/explore'
;
describe
(
'TableContainer'
,
()
=>
{
it
(
'should render component'
,
()
=>
{
const
props
=
{
exploreId
:
ExploreId
.
left
as
ExploreId
,
loading
:
false
,
width
:
800
,
onClickCell
:
jest
.
fn
(),
showingTable
:
true
,
tableResult
:
{}
as
DataFrame
,
toggleTable
:
{}
as
typeof
toggleTable
,
};
const
wrapper
=
shallow
(<
TableContainer
{
...
props
}
/>);
expect
(
wrapper
).
toMatchSnapshot
();
});
it
(
'should render 0 series returned on no items'
,
()
=>
{
const
props
=
{
exploreId
:
ExploreId
.
left
as
ExploreId
,
loading
:
false
,
width
:
800
,
onClickCell
:
jest
.
fn
(),
showingTable
:
true
,
tableResult
:
{
name
:
'TableResultName'
,
fields
:
[],
length
:
0
,
}
as
DataFrame
,
toggleTable
:
{}
as
typeof
toggleTable
,
};
const
wrapper
=
render
(<
TableContainer
{
...
props
}
/>);
expect
(
wrapper
.
find
(
'0 series returned'
)).
toBeTruthy
();
});
});
public/app/features/explore/__snapshots__/TableContainer.test.tsx.snap
0 → 100644
View file @
c425a837
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TableContainer should render component 1`] = `
<Collapse
collapsible={true}
isOpen={true}
label="Table"
loading={false}
onToggle={[Function]}
>
<Component
metaItems={
Array [
Object {
"value": "0 series returned",
},
]
}
/>
</Collapse>
`;
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