Commit d91e9ddd by Tobias Skarhed

Convert tests from Karma to Jest

parent dbaa45e5
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.be('green');
expect(getColorForValue(data, 5)).toBe('green');
});
it('19.9 should return green', () => {
expect(getColorForValue(data, 19.9)).to.be('green');
expect(getColorForValue(data, 19.9)).toBe('green');
});
it('20 should return yellow', () => {
expect(getColorForValue(data, 20)).to.be('yellow');
expect(getColorForValue(data, 20)).toBe('yellow');
});
it('20.1 should return yellow', () => {
expect(getColorForValue(data, 20.1)).to.be('yellow');
expect(getColorForValue(data, 20.1)).toBe('yellow');
});
it('25 should return yellow', () => {
expect(getColorForValue(data, 25)).to.be('yellow');
expect(getColorForValue(data, 25)).toBe('yellow');
});
it('50 should return red', () => {
expect(getColorForValue(data, 50)).to.be('red');
expect(getColorForValue(data, 50)).toBe('red');
});
it('55 should return red', () => {
expect(getColorForValue(data, 55)).to.be('red');
expect(getColorForValue(data, 55)).toBe('red');
});
});
});
......@@ -47,15 +45,15 @@ describe('grafanaSingleStat', function() {
};
it('-30 should return green', () => {
expect(getColorForValue(data, -30)).to.be('green');
expect(getColorForValue(data, -30)).toBe('green');
});
it('1 should return green', () => {
expect(getColorForValue(data, 1)).to.be('yellow');
expect(getColorForValue(data, 1)).toBe('yellow');
});
it('22 should return green', () => {
expect(getColorForValue(data, 22)).to.be('red');
expect(getColorForValue(data, 22)).toBe('red');
});
});
......@@ -66,7 +64,7 @@ describe('grafanaSingleStat', function() {
};
it('-30 should return green', () => {
expect(getColorForValue(data, -26)).to.be('yellow');
expect(getColorForValue(data, -26)).toBe('yellow');
});
});
});
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.be(1);
expect(semver.minor).to.be(0);
expect(semver.patch).to.be(0);
expect(semver.meta).to.be('alpha.1');
expect(semver.major).toBe(1);
expect(semver.minor).toBe(0);
expect(semver.patch).toBe(0);
expect(semver.meta).toBe('alpha.1');
});
});
......@@ -30,7 +28,7 @@ describe("SemVersion", () => {
{value: '3.5', expected: false},
];
cases.forEach((testCase) => {
expect(semver.isGtOrEq(testCase.value)).to.be(testCase.expected);
expect(semver.isGtOrEq(testCase.value)).toBe(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.be(testCase.expected);
expect(isVersionGtOrEq(testCase.values[0], testCase.values[1])).toBe(testCase.expected);
});
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment