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
7a277c69
Commit
7a277c69
authored
Oct 22, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: migrated two more tests to jest
parent
c6feb903
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
22 deletions
+12
-22
public/app/plugins/panel/graph/data_processor.ts
+1
-3
public/app/plugins/panel/graph/specs/data_processor.jest.ts
+7
-11
public/app/plugins/panel/graph/specs/histogram.jest.ts
+4
-8
No files found.
public/app/plugins/panel/graph/data_processor.ts
View file @
7a277c69
///<reference path="../../../headers/common.d.ts" />
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
TimeSeries
from
'app/core/time_series2'
;
import
TimeSeries
from
'app/core/time_series2'
;
import
{
colors
}
from
'app/core/
core
'
;
import
{
colors
}
from
'app/core/
utils/colors
'
;
export
class
DataProcessor
{
export
class
DataProcessor
{
...
...
public/app/plugins/panel/graph/specs/data_processor
_specs
.ts
→
public/app/plugins/panel/graph/specs/data_processor
.jest
.ts
View file @
7a277c69
///<reference path="../../../../headers/common.d.ts" />
import
{
describe
,
beforeEach
,
it
,
expect
}
from
'../../../../../test/lib/common'
;
import
{
DataProcessor
}
from
'../data_processor'
;
import
{
DataProcessor
}
from
'../data_processor'
;
describe
(
'Graph DataProcessor'
,
function
()
{
describe
(
'Graph DataProcessor'
,
function
()
{
...
@@ -29,7 +25,7 @@ describe('Graph DataProcessor', function() {
...
@@ -29,7 +25,7 @@ describe('Graph DataProcessor', function() {
});
});
it
(
'Should automatically set xaxis mode to field'
,
()
=>
{
it
(
'Should automatically set xaxis mode to field'
,
()
=>
{
expect
(
panel
.
xaxis
.
mode
).
to
.
b
e
(
'field'
);
expect
(
panel
.
xaxis
.
mode
).
to
B
e
(
'field'
);
});
});
});
});
...
@@ -48,16 +44,16 @@ describe('Graph DataProcessor', function() {
...
@@ -48,16 +44,16 @@ describe('Graph DataProcessor', function() {
it
(
'Should return all field names'
,
()
=>
{
it
(
'Should return all field names'
,
()
=>
{
var
fields
=
processor
.
getDataFieldNames
(
dataList
,
false
);
var
fields
=
processor
.
getDataFieldNames
(
dataList
,
false
);
expect
(
fields
).
to
.
c
ontain
(
'hostname'
);
expect
(
fields
).
to
C
ontain
(
'hostname'
);
expect
(
fields
).
to
.
c
ontain
(
'valueField'
);
expect
(
fields
).
to
C
ontain
(
'valueField'
);
expect
(
fields
).
to
.
c
ontain
(
'nested.prop1'
);
expect
(
fields
).
to
C
ontain
(
'nested.prop1'
);
expect
(
fields
).
to
.
c
ontain
(
'nested.value2'
);
expect
(
fields
).
to
C
ontain
(
'nested.value2'
);
});
});
it
(
'Should return all number fields'
,
()
=>
{
it
(
'Should return all number fields'
,
()
=>
{
var
fields
=
processor
.
getDataFieldNames
(
dataList
,
true
);
var
fields
=
processor
.
getDataFieldNames
(
dataList
,
true
);
expect
(
fields
).
to
.
c
ontain
(
'valueField'
);
expect
(
fields
).
to
C
ontain
(
'valueField'
);
expect
(
fields
).
to
.
c
ontain
(
'nested.value2'
);
expect
(
fields
).
to
C
ontain
(
'nested.value2'
);
});
});
});
});
});
});
...
...
public/app/plugins/panel/graph/specs/histogram
_specs
.ts
→
public/app/plugins/panel/graph/specs/histogram
.jest
.ts
View file @
7a277c69
///<reference path="../../../../headers/common.d.ts" />
import
{
describe
,
beforeEach
,
it
,
expect
}
from
'../../../../../test/lib/common'
;
import
{
convertValuesToHistogram
,
getSeriesValues
}
from
'../histogram'
;
import
{
convertValuesToHistogram
,
getSeriesValues
}
from
'../histogram'
;
describe
(
'Graph Histogam Converter'
,
function
()
{
describe
(
'Graph Histogam Converter'
,
function
()
{
...
@@ -21,7 +17,7 @@ describe('Graph Histogam Converter', function () {
...
@@ -21,7 +17,7 @@ describe('Graph Histogam Converter', function () {
];
];
let
histogram
=
convertValuesToHistogram
(
values
,
bucketSize
);
let
histogram
=
convertValuesToHistogram
(
values
,
bucketSize
);
expect
(
histogram
).
to
.
eql
(
expected
);
expect
(
histogram
).
to
MatchObject
(
expected
);
});
});
it
(
'Should not add empty buckets'
,
()
=>
{
it
(
'Should not add empty buckets'
,
()
=>
{
...
@@ -31,7 +27,7 @@ describe('Graph Histogam Converter', function () {
...
@@ -31,7 +27,7 @@ describe('Graph Histogam Converter', function () {
];
];
let
histogram
=
convertValuesToHistogram
(
values
,
bucketSize
);
let
histogram
=
convertValuesToHistogram
(
values
,
bucketSize
);
expect
(
histogram
).
to
.
eql
(
expected
);
expect
(
histogram
).
to
MatchObject
(
expected
);
});
});
});
});
...
@@ -50,7 +46,7 @@ describe('Graph Histogam Converter', function () {
...
@@ -50,7 +46,7 @@ describe('Graph Histogam Converter', function () {
let
expected
=
[
1
,
2
,
10
,
11
,
17
,
20
,
29
];
let
expected
=
[
1
,
2
,
10
,
11
,
17
,
20
,
29
];
let
values
=
getSeriesValues
(
data
);
let
values
=
getSeriesValues
(
data
);
expect
(
values
).
to
.
eql
(
expected
);
expect
(
values
).
to
MatchObject
(
expected
);
});
});
it
(
'Should skip null values'
,
()
=>
{
it
(
'Should skip null values'
,
()
=>
{
...
@@ -59,7 +55,7 @@ describe('Graph Histogam Converter', function () {
...
@@ -59,7 +55,7 @@ describe('Graph Histogam Converter', function () {
let
expected
=
[
1
,
2
,
10
,
11
,
17
,
20
,
29
];
let
expected
=
[
1
,
2
,
10
,
11
,
17
,
20
,
29
];
let
values
=
getSeriesValues
(
data
);
let
values
=
getSeriesValues
(
data
);
expect
(
values
).
to
.
eql
(
expected
);
expect
(
values
).
to
MatchObject
(
expected
);
});
});
});
});
});
});
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