@netdata/charts
Version:
Netdata frontend SDK and chart utilities
27 lines • 922 B
JavaScript
import { darkenColor } from "./helpers";
describe("darkenColor", function () {
it("darkens RGB color strings", function () {
var result = darkenColor("rgb(100, 150, 200)");
expect(result).toBe("rgb(177,202,227)");
});
it("darkens hex colors", function () {
var result = darkenColor("#ff0000");
expect(result).toBe("rgb(255,127,127)");
});
it("darkens blue hex color", function () {
var result = darkenColor("#0000ff");
expect(result).toBe("rgb(127,127,255)");
});
it("handles black color", function () {
var result = darkenColor("#000000");
expect(result).toBe("rgb(127,127,127)");
});
it("handles white color", function () {
var result = darkenColor("#ffffff");
expect(result).toBe("rgb(255,255,255)");
});
it("handles edge case with rgb(0,0,0)", function () {
var result = darkenColor("rgb(0,0,0)");
expect(result).toBe("rgb(127,127,127)");
});
});