Updating spec from merge
BrainDoctor committed
Jul 18, 2017 at 11:15 UTC
68af8a58ca6062d6f2975a97de1cf21f38779db2
1 file changed
+13
-11
tests/web/easypiechart.spec.js
+13
-11
@@ -1,18 +1,29 @@
1
// delete these comments if not needed anymore.
2
3
+function createState(min, max) {
4
+ // create a fake state with only needed properties? Spying? not figured it out yet...
5
+ return {
6
+ tmp: {
7
+ easyPieChartMin: min,
8
+ easyPieChartMax: max
9
+ }
10
+ };
11
+}
12
+
13
+
14
describe("percentage calculations for easy pie charts", function () {
15
16
// some easy functions to test. incomplete yet.
17
it('should return 50 if positive value between min and max', function () {
18
// act
8
- var result = NETDATA.easypiechartPercentFromValueMinMax(1, 0, 2);
19
+ var result = NETDATA.easypiechartPercentFromValueMinMax(createState(0, 0), 1, 0, 2);
20
// assert
21
expect(result).toBe(50);
22
});
23
24
it('should return 0.1 if value is zero', function () {
25
// act
15
- var result = NETDATA.easypiechartPercentFromValueMinMax(0, 0, 2);
26
+ var result = NETDATA.easypiechartPercentFromValueMinMax(createState(0, 0), 0, 0, 2);
27
// assert
28
expect(result).toBe(0.1);
29
});
@@ -46,13 +57,4 @@ describe('creation of easy pie charts', function () {
57
expect(result).toBe(true);
58
});
59
49
- function createState() {
50
- // create a fake state with only needed properties? Spying? not figured it out yet...
51
- return {
52
- tmp: {
53
-
54
- }
55
- };
56
- }
57
-
60
});
\ No newline at end of file