@netdata/charts
Version:
Netdata frontend SDK and chart utilities
57 lines • 1.5 kB
JavaScript
import { makeTestChart } from "@jest/testUtilities";
import point from "./point";
describe("point overlay", function () {
it("handles overlay access", function () {
var _makeTestChart = makeTestChart(),
chart = _makeTestChart.chart;
chart.getAttribute = function (key) {
if (key === "overlays") {
return {
"test-point": {
row: 5
}
};
}
return {};
};
var chartUI = {
chart: chart,
getDygraph: function getDygraph() {
return {
getArea: function getArea() {
return {
h: 100
};
},
canvas_ctx_: {
save: function save() {},
restore: function restore() {},
setLineDash: function setLineDash() {},
beginPath: function beginPath() {},
moveTo: function moveTo() {},
lineTo: function lineTo() {},
stroke: function stroke() {},
strokeStyle: "",
lineWidth: 0
}
};
}
};
expect(function () {
return point(chartUI, "test-point");
}).not.toThrow();
});
it("handles missing overlay", function () {
var _makeTestChart2 = makeTestChart(),
chart = _makeTestChart2.chart;
chart.getAttribute = function () {
return {};
};
var chartUI = {
chart: chart
};
expect(function () {
return point(chartUI, "missing-overlay");
}).toThrow();
});
});