blob: 8f5e49631c2bf2ba8b0a6117300d0958dbfd159c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
"use strict";
// with xdescribe, this is skipped.
describe("creation of easy pie charts", function () {
beforeAll(function () {
// karma stores the loaded files relative to "base/".
// This command is needed to load HTML fixtures
jasmine.getFixtures().fixturesPath = "base/tests/web/fixtures";
});
it("should create new chart, but it's failure is expected for demonstration purpose", function () {
// arrange
// Theoretically we can load some html. What about jquery? could this work?
// https://stackoverflow.com/questions/5337481/spying-on-jquery-selectors-in-jasmine
loadFixtures("easypiechart.chart.fixture1.html");
// for easy pie chart, we can fake the data result:
var data = {
result: [5]
};
// act
var result = NETDATA.easypiechartChartCreate(createState(), data);
// assert
expect(result).toBe(true);
});
function createState(min, max) {
// create a fake state with only needed properties.
return {
tmp: {
easyPieChartMin: min,
easyPieChartMax: max
}
};
}
});
|