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
7c78e8e3
Commit
7c78e8e3
authored
Feb 27, 2018
by
Alexander Zobnin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
heatmap: add few tests for histogram converter
parent
26ddb997
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
22 deletions
+34
-22
public/app/plugins/panel/heatmap/specs/heatmap_data_converter.jest.ts
+34
-22
No files found.
public/app/plugins/panel/heatmap/specs/heatmap_data_converter.jest.ts
View file @
7c78e8e3
...
...
@@ -4,7 +4,7 @@ import TimeSeries from 'app/core/time_series2';
import
{
convertToHeatMap
,
convertToCards
,
elasticH
istogramToHeatmap
,
h
istogramToHeatmap
,
calculateBucketSize
,
isHeatmapDataEqual
,
}
from
'../heatmap_data_converter'
;
...
...
@@ -216,7 +216,7 @@ describe('HeatmapDataConverter', () => {
});
});
describe
(
'
ES
Histogram converter'
,
()
=>
{
describe
(
'Histogram converter'
,
()
=>
{
let
ctx
:
any
=
{};
beforeEach
(()
=>
{
...
...
@@ -244,7 +244,7 @@ describe('ES Histogram converter', () => {
);
});
describe
(
'when converting
ES
histogram'
,
()
=>
{
describe
(
'when converting histogram'
,
()
=>
{
beforeEach
(()
=>
{});
it
(
'should build proper heatmap data'
,
()
=>
{
...
...
@@ -252,60 +252,72 @@ describe('ES Histogram converter', () => {
'1422774000000'
:
{
x
:
1422774000000
,
buckets
:
{
'
1
'
:
{
y
:
1
,
'
0
'
:
{
y
:
0
,
count
:
1
,
bounds
:
{
bottom
:
0
,
top
:
null
},
values
:
[],
points
:
[],
bounds
:
{
bottom
:
1
,
top
:
null
},
},
'
2
'
:
{
y
:
2
,
'
1
'
:
{
y
:
1
,
count
:
5
,
bounds
:
{
bottom
:
1
,
top
:
null
},
values
:
[],
points
:
[],
bounds
:
{
bottom
:
2
,
top
:
null
},
},
'
3
'
:
{
y
:
3
,
'
2
'
:
{
y
:
2
,
count
:
0
,
bounds
:
{
bottom
:
2
,
top
:
null
},
values
:
[],
points
:
[],
bounds
:
{
bottom
:
3
,
top
:
null
},
},
},
},
'1422774060000'
:
{
x
:
1422774060000
,
buckets
:
{
'
1
'
:
{
y
:
1
,
'
0
'
:
{
y
:
0
,
count
:
0
,
bounds
:
{
bottom
:
0
,
top
:
null
},
values
:
[],
points
:
[],
bounds
:
{
bottom
:
1
,
top
:
null
},
},
'
2
'
:
{
y
:
2
,
'
1
'
:
{
y
:
1
,
count
:
3
,
bounds
:
{
bottom
:
1
,
top
:
null
},
values
:
[],
points
:
[],
bounds
:
{
bottom
:
2
,
top
:
null
},
},
'
3
'
:
{
y
:
3
,
'
2
'
:
{
y
:
2
,
count
:
1
,
bounds
:
{
bottom
:
2
,
top
:
null
},
values
:
[],
points
:
[],
bounds
:
{
bottom
:
3
,
top
:
null
},
},
},
},
};
let
heatmap
=
elasticH
istogramToHeatmap
(
ctx
.
series
);
const
heatmap
=
h
istogramToHeatmap
(
ctx
.
series
);
expect
(
heatmap
).
toEqual
(
expectedHeatmap
);
});
it
(
'should use bucket index as a bound'
,
()
=>
{
const
heatmap
=
histogramToHeatmap
(
ctx
.
series
);
const
bucketLabels
=
_
.
map
(
heatmap
[
'1422774000000'
].
buckets
,
(
b
,
label
)
=>
label
);
const
bucketYs
=
_
.
map
(
heatmap
[
'1422774000000'
].
buckets
,
'y'
);
const
bucketBottoms
=
_
.
map
(
heatmap
[
'1422774000000'
].
buckets
,
b
=>
b
.
bounds
.
bottom
);
const
expectedBounds
=
[
0
,
1
,
2
];
expect
(
bucketLabels
).
toEqual
(
_
.
map
(
expectedBounds
,
b
=>
b
.
toString
()));
expect
(
bucketYs
).
toEqual
(
expectedBounds
);
expect
(
bucketBottoms
).
toEqual
(
expectedBounds
);
});
});
});
...
...
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