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
0280179d
Commit
0280179d
authored
Nov 09, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: add tests for render snapshop and default query type
parent
7bdf97d3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.test.tsx
+19
-4
No files found.
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.test.tsx
View file @
0280179d
...
...
@@ -3,15 +3,30 @@ import renderer from 'react-test-renderer';
import
{
StackdriverTemplateQueryComponent
}
from
'./TemplateQueryComponent'
;
import
{
TemplateQueryProps
}
from
'app/types/plugins'
;
describe
(
'StackdriverTemplateQueryComponent'
,
()
=>
{
const
props
:
TemplateQueryProps
=
{
jest
.
mock
(
'../functions'
,
()
=>
({
getMetricTypes
:
()
=>
Promise
.
resolve
({
metricTypes
:
[],
selectedMetricType
:
''
}),
extractServicesFromMetricDescriptors
:
m
=>
m
,
}));
const
props
:
TemplateQueryProps
=
{
onChange
:
(
query
,
definition
)
=>
{},
query
:
''
,
datasource
:
{},
};
datasource
:
{
getMetricTypes
:
async
p
=>
[],
},
};
describe
(
'StackdriverTemplateQueryComponent'
,
()
=>
{
it
(
'renders correctly'
,
()
=>
{
const
tree
=
renderer
.
create
(<
StackdriverTemplateQueryComponent
{
...
props
}
/>).
toJSON
();
expect
(
tree
).
toMatchSnapshot
();
});
it
(
'should use the first query type in the array if no query type was saved before'
,
done
=>
{
props
.
onChange
=
(
query
,
definition
)
=>
{
expect
(
definition
).
toBe
(
'Stackdriver - Services'
);
done
();
};
renderer
.
create
(<
StackdriverTemplateQueryComponent
{
...
props
}
/>).
toJSON
();
});
});
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