@netdata/charts
Version:
Netdata frontend SDK and chart utilities
63 lines • 2.16 kB
JavaScript
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
import Badge, { getColors } from "./badge";
describe("Badge component", function () {
it("exports Badge component", function () {
expect(Badge).toBeDefined();
expect(_typeof(Badge)).toBe("function");
});
it("exports getColors function", function () {
expect(getColors).toBeDefined();
expect(_typeof(getColors)).toBe("function");
});
});
describe("getColors function", function () {
it("returns error colors for error type", function () {
var colors = getColors("error");
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
it("returns warning colors for warning type", function () {
var colors = getColors("warning");
expect(colors).toEqual({
background: "warningBackground",
color: "warningText"
});
});
it("returns success colors for success type", function () {
var colors = getColors("success");
expect(colors).toEqual({
background: ["green", "frostee"],
color: "success"
});
});
it("returns neutral colors for neutral type", function () {
var colors = getColors("neutral");
expect(colors).toEqual({
background: "elementBackground",
color: "textLite"
});
});
it("returns error colors for unknown type", function () {
var colors = getColors("unknown");
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
it("returns error colors for undefined type", function () {
var colors = getColors(undefined);
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
it("returns error colors for null type", function () {
var colors = getColors(null);
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
});