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
d91e9ddd
Commit
d91e9ddd
authored
Jun 12, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert tests from Karma to Jest
parent
dbaa45e5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
21 deletions
+17
-21
public/app/plugins/panel/singlestat/specs/singlestat_panel.jest.ts
+11
-13
public/test/core/utils/version_jest.ts
+6
-8
No files found.
public/app/plugins/panel/singlestat/specs/singlestat_panel
_spec
.ts
→
public/app/plugins/panel/singlestat/specs/singlestat_panel
.jest
.ts
View file @
d91e9ddd
import
{
describe
,
it
,
expect
}
from
'test/lib/common'
;
import
{
getColorForValue
}
from
'../module'
;
describe
(
'grafanaSingleStat'
,
function
()
{
...
...
@@ -11,31 +9,31 @@ describe('grafanaSingleStat', function() {
};
it
(
'5 should return green'
,
()
=>
{
expect
(
getColorForValue
(
data
,
5
)).
to
.
b
e
(
'green'
);
expect
(
getColorForValue
(
data
,
5
)).
to
B
e
(
'green'
);
});
it
(
'19.9 should return green'
,
()
=>
{
expect
(
getColorForValue
(
data
,
19.9
)).
to
.
b
e
(
'green'
);
expect
(
getColorForValue
(
data
,
19.9
)).
to
B
e
(
'green'
);
});
it
(
'20 should return yellow'
,
()
=>
{
expect
(
getColorForValue
(
data
,
20
)).
to
.
b
e
(
'yellow'
);
expect
(
getColorForValue
(
data
,
20
)).
to
B
e
(
'yellow'
);
});
it
(
'20.1 should return yellow'
,
()
=>
{
expect
(
getColorForValue
(
data
,
20.1
)).
to
.
b
e
(
'yellow'
);
expect
(
getColorForValue
(
data
,
20.1
)).
to
B
e
(
'yellow'
);
});
it
(
'25 should return yellow'
,
()
=>
{
expect
(
getColorForValue
(
data
,
25
)).
to
.
b
e
(
'yellow'
);
expect
(
getColorForValue
(
data
,
25
)).
to
B
e
(
'yellow'
);
});
it
(
'50 should return red'
,
()
=>
{
expect
(
getColorForValue
(
data
,
50
)).
to
.
b
e
(
'red'
);
expect
(
getColorForValue
(
data
,
50
)).
to
B
e
(
'red'
);
});
it
(
'55 should return red'
,
()
=>
{
expect
(
getColorForValue
(
data
,
55
)).
to
.
b
e
(
'red'
);
expect
(
getColorForValue
(
data
,
55
)).
to
B
e
(
'red'
);
});
});
});
...
...
@@ -47,15 +45,15 @@ describe('grafanaSingleStat', function() {
};
it
(
'-30 should return green'
,
()
=>
{
expect
(
getColorForValue
(
data
,
-
30
)).
to
.
b
e
(
'green'
);
expect
(
getColorForValue
(
data
,
-
30
)).
to
B
e
(
'green'
);
});
it
(
'1 should return green'
,
()
=>
{
expect
(
getColorForValue
(
data
,
1
)).
to
.
b
e
(
'yellow'
);
expect
(
getColorForValue
(
data
,
1
)).
to
B
e
(
'yellow'
);
});
it
(
'22 should return green'
,
()
=>
{
expect
(
getColorForValue
(
data
,
22
)).
to
.
b
e
(
'red'
);
expect
(
getColorForValue
(
data
,
22
)).
to
B
e
(
'red'
);
});
});
...
...
@@ -66,7 +64,7 @@ describe('grafanaSingleStat', function() {
};
it
(
'-30 should return green'
,
()
=>
{
expect
(
getColorForValue
(
data
,
-
26
)).
to
.
b
e
(
'yellow'
);
expect
(
getColorForValue
(
data
,
-
26
)).
to
B
e
(
'yellow'
);
});
});
});
public/test/core/utils/version_
specs
.ts
→
public/test/core/utils/version_
jest
.ts
View file @
d91e9ddd
import
{
describe
,
beforeEach
,
it
,
expect
}
from
'test/lib/common'
;
import
{
SemVersion
,
isVersionGtOrEq
}
from
'app/core/utils/version'
;
describe
(
"SemVersion"
,
()
=>
{
...
...
@@ -8,10 +6,10 @@ describe("SemVersion", () => {
describe
(
'parsing'
,
()
=>
{
it
(
'should parse version properly'
,
()
=>
{
let
semver
=
new
SemVersion
(
version
);
expect
(
semver
.
major
).
to
.
b
e
(
1
);
expect
(
semver
.
minor
).
to
.
b
e
(
0
);
expect
(
semver
.
patch
).
to
.
b
e
(
0
);
expect
(
semver
.
meta
).
to
.
b
e
(
'alpha.1'
);
expect
(
semver
.
major
).
to
B
e
(
1
);
expect
(
semver
.
minor
).
to
B
e
(
0
);
expect
(
semver
.
patch
).
to
B
e
(
0
);
expect
(
semver
.
meta
).
to
B
e
(
'alpha.1'
);
});
});
...
...
@@ -30,7 +28,7 @@ describe("SemVersion", () => {
{
value
:
'3.5'
,
expected
:
false
},
];
cases
.
forEach
((
testCase
)
=>
{
expect
(
semver
.
isGtOrEq
(
testCase
.
value
)).
to
.
b
e
(
testCase
.
expected
);
expect
(
semver
.
isGtOrEq
(
testCase
.
value
)).
to
B
e
(
testCase
.
expected
);
});
});
});
...
...
@@ -48,7 +46,7 @@ describe("SemVersion", () => {
{
values
:
[
'3.4.5'
,
'3.5'
],
expected
:
false
},
];
cases
.
forEach
((
testCase
)
=>
{
expect
(
isVersionGtOrEq
(
testCase
.
values
[
0
],
testCase
.
values
[
1
])).
to
.
b
e
(
testCase
.
expected
);
expect
(
isVersionGtOrEq
(
testCase
.
values
[
0
],
testCase
.
values
[
1
])).
to
B
e
(
testCase
.
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