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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.test.tsx
+21
-6
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';
...
@@ -3,15 +3,30 @@ import renderer from 'react-test-renderer';
import
{
StackdriverTemplateQueryComponent
}
from
'./TemplateQueryComponent'
;
import
{
StackdriverTemplateQueryComponent
}
from
'./TemplateQueryComponent'
;
import
{
TemplateQueryProps
}
from
'app/types/plugins'
;
import
{
TemplateQueryProps
}
from
'app/types/plugins'
;
describe
(
'StackdriverTemplateQueryComponent'
,
()
=>
{
jest
.
mock
(
'../functions'
,
()
=>
({
const
props
:
TemplateQueryProps
=
{
getMetricTypes
:
()
=>
Promise
.
resolve
({
metricTypes
:
[],
selectedMetricType
:
''
}),
onChange
:
(
query
,
definition
)
=>
{},
extractServicesFromMetricDescriptors
:
m
=>
m
,
query
:
''
,
}));
datasource
:
{},
};
const
props
:
TemplateQueryProps
=
{
onChange
:
(
query
,
definition
)
=>
{},
query
:
''
,
datasource
:
{
getMetricTypes
:
async
p
=>
[],
},
};
describe
(
'StackdriverTemplateQueryComponent'
,
()
=>
{
it
(
'renders correctly'
,
()
=>
{
it
(
'renders correctly'
,
()
=>
{
const
tree
=
renderer
.
create
(<
StackdriverTemplateQueryComponent
{
...
props
}
/>).
toJSON
();
const
tree
=
renderer
.
create
(<
StackdriverTemplateQueryComponent
{
...
props
}
/>).
toJSON
();
expect
(
tree
).
toMatchSnapshot
();
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