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
d23c3d2b
Commit
d23c3d2b
authored
Jan 03, 2019
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests
parent
3ce4287e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
2 deletions
+60
-2
public/app/plugins/datasource/stackdriver/components/Filter.tsx
+3
-1
public/app/plugins/datasource/stackdriver/components/QueryEditor.test.tsx
+18
-0
public/app/plugins/datasource/stackdriver/components/QueryEditor.tsx
+1
-1
public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap
+0
-0
public/app/plugins/datasource/stackdriver/functions.test.ts
+38
-0
No files found.
public/app/plugins/datasource/stackdriver/components/Filter.tsx
View file @
d23c3d2b
...
...
@@ -52,11 +52,13 @@ export class Filter extends React.Component<Props, State> {
hideGroupBys
,
};
scopeProps
.
loading
=
this
.
loadLabels
(
scopeProps
);
this
.
component
=
loader
.
load
(
this
.
element
,
scopeProps
,
template
);
}
componentDidUpdate
(
prevProps
:
Props
)
{
if
(
!
this
.
element
)
{
return
;
}
const
scope
=
this
.
component
.
getScope
();
if
(
prevProps
.
metricType
!==
this
.
props
.
metricType
)
{
scope
.
loading
=
this
.
loadLabels
(
scope
);
...
...
public/app/plugins/datasource/stackdriver/components/QueryEditor.test.tsx
0 → 100644
View file @
d23c3d2b
import
React
from
'react'
;
import
renderer
from
'react-test-renderer'
;
import
{
QueryEditor
,
Props
,
DefaultTarget
}
from
'./QueryEditor'
;
const
props
:
Props
=
{
onQueryChange
:
target
=>
{},
onExecuteQuery
:
()
=>
{},
target
:
DefaultTarget
,
events
:
{
on
:
()
=>
{}
},
datasource
:
{
templateSrv
:
{
variables
:
[]
}
},
};
describe
(
'QueryEditor'
,
()
=>
{
it
(
'renders correctly'
,
()
=>
{
const
tree
=
renderer
.
create
(<
QueryEditor
{
...
props
}
/>).
toJSON
();
expect
(
tree
).
toMatchSnapshot
();
});
});
public/app/plugins/datasource/stackdriver/components/QueryEditor.tsx
View file @
d23c3d2b
...
...
@@ -26,7 +26,7 @@ interface State extends Target {
[
key
:
string
]:
any
;
}
const
DefaultTarget
:
State
=
{
export
const
DefaultTarget
:
State
=
{
defaultProject
:
'loading project...'
,
metricType
:
''
,
metricKind
:
''
,
...
...
public/app/plugins/datasource/stackdriver/components/__snapshots__/QueryEditor.test.tsx.snap
0 → 100644
View file @
d23c3d2b
This diff is collapsed.
Click to expand it.
public/app/plugins/datasource/stackdriver/functions.test.ts
0 → 100644
View file @
d23c3d2b
import
{
getAlignmentOptionsByMetric
}
from
'./functions'
;
import
{
ValueTypes
,
MetricKind
}
from
'./constants'
;
describe
(
'functions'
,
()
=>
{
let
result
;
describe
(
'getAlignmentOptionsByMetric'
,
()
=>
{
describe
(
'when double and gauge is passed'
,
()
=>
{
beforeEach
(()
=>
{
result
=
getAlignmentOptionsByMetric
(
ValueTypes
.
DOUBLE
,
MetricKind
.
GAUGE
);
});
it
(
'should return all alignment options except two'
,
()
=>
{
expect
(
result
.
length
).
toBe
(
9
);
expect
(
result
.
map
(
o
=>
o
.
value
)).
toEqual
(
expect
.
not
.
arrayContaining
([
'REDUCE_COUNT_TRUE'
,
'REDUCE_COUNT_FALSE'
])
);
});
});
describe
(
'when double and delta is passed'
,
()
=>
{
beforeEach
(()
=>
{
result
=
getAlignmentOptionsByMetric
(
ValueTypes
.
DOUBLE
,
MetricKind
.
DELTA
);
});
it
(
'should return all alignment options except four'
,
()
=>
{
expect
(
result
.
length
).
toBe
(
9
);
expect
(
result
.
map
(
o
=>
o
.
value
)).
toEqual
(
expect
.
not
.
arrayContaining
([
'ALIGN_COUNT_TRUE'
,
'ALIGN_COUNT_FALSE'
,
'ALIGN_FRACTION_TRUE'
,
'ALIGN_INTERPOLATE'
,
])
);
});
});
});
});
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