@netdata/charts
Version:
Netdata frontend SDK and chart utilities
66 lines (65 loc) • 2.96 kB
JavaScript
;
var _badge = _interopRequireWildcard(require("./badge"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
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); }
describe("Badge component", function () {
it("exports Badge component", function () {
expect(_badge["default"]).toBeDefined();
expect(_typeof(_badge["default"])).toBe("function");
});
it("exports getColors function", function () {
expect(_badge.getColors).toBeDefined();
expect(_typeof(_badge.getColors)).toBe("function");
});
});
describe("getColors function", function () {
it("returns error colors for error type", function () {
var colors = (0, _badge.getColors)("error");
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
it("returns warning colors for warning type", function () {
var colors = (0, _badge.getColors)("warning");
expect(colors).toEqual({
background: "warningBackground",
color: "warningText"
});
});
it("returns success colors for success type", function () {
var colors = (0, _badge.getColors)("success");
expect(colors).toEqual({
background: ["green", "frostee"],
color: "success"
});
});
it("returns neutral colors for neutral type", function () {
var colors = (0, _badge.getColors)("neutral");
expect(colors).toEqual({
background: "elementBackground",
color: "textLite"
});
});
it("returns error colors for unknown type", function () {
var colors = (0, _badge.getColors)("unknown");
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
it("returns error colors for undefined type", function () {
var colors = (0, _badge.getColors)(undefined);
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
it("returns error colors for null type", function () {
var colors = (0, _badge.getColors)(null);
expect(colors).toEqual({
background: "errorBackground",
color: "errorText"
});
});
});