@netdata/charts
Version:
Netdata frontend SDK and chart utilities
41 lines • 1.97 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 allUnits from "./all";
describe("allUnits", function () {
it("exports an object with prefixes and units", function () {
expect(_typeof(allUnits)).toBe("object");
expect(allUnits).not.toBe(null);
expect(allUnits).toHaveProperty("prefixes");
});
it("contains standard SI prefixes", function () {
var prefixes = allUnits.prefixes;
expect(prefixes).toHaveProperty("Y");
expect(prefixes).toHaveProperty("Z");
expect(prefixes).toHaveProperty("E");
expect(prefixes).toHaveProperty("P");
expect(prefixes).toHaveProperty("T");
expect(prefixes).toHaveProperty("G");
expect(prefixes).toHaveProperty("M");
});
it("prefix objects have required properties", function () {
var prefixes = allUnits.prefixes;
var yottaPrefix = prefixes.Y;
expect(yottaPrefix).toHaveProperty("symbol");
expect(yottaPrefix).toHaveProperty("name");
expect(yottaPrefix).toHaveProperty("print_symbol");
expect(yottaPrefix).toHaveProperty("value");
expect(yottaPrefix).toHaveProperty("is_binary");
expect(_typeof(yottaPrefix.symbol)).toBe("string");
expect(_typeof(yottaPrefix.name)).toBe("string");
expect(_typeof(yottaPrefix.value)).toBe("number");
expect(_typeof(yottaPrefix.is_binary)).toBe("boolean");
});
it("prefixes have correct values", function () {
var prefixes = allUnits.prefixes;
expect(prefixes.Y.value).toBe(1e24);
expect(prefixes.Z.value).toBe(1e21);
expect(prefixes.E.value).toBe(1e18);
expect(prefixes.T.value).toBe(1000000000000.0);
expect(prefixes.G.value).toBe(1000000000.0);
expect(prefixes.M.value).toBe(1000000.0);
});
});