mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Convert tests from Karma to Jest
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,3 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user