summaryrefslogtreecommitdiffstats
path: root/tests/node.d/fronius.parse.spec.js
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2018-03-27 21:28:21 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2018-03-27 21:28:21 +0000
commitd4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c (patch)
treefaac99f51f182bb8c0a03e95e393d421ac9ddf42 /tests/node.d/fronius.parse.spec.js
parentNew upstream version 1.9.0+dfsg (diff)
downloadnetdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.tar.xz
netdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.zip
New upstream version 1.10.0+dfsgupstream/1.10.0+dfsg
Diffstat (limited to 'tests/node.d/fronius.parse.spec.js')
-rw-r--r--tests/node.d/fronius.parse.spec.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/node.d/fronius.parse.spec.js b/tests/node.d/fronius.parse.spec.js
index 9c371ad98..0dbfa030d 100644
--- a/tests/node.d/fronius.parse.spec.js
+++ b/tests/node.d/fronius.parse.spec.js
@@ -234,6 +234,33 @@ describe("fronius parsing for autonomy", function () {
expect(result.name).toBe(subject.consumptionSelfId);
expect(result.value).toBe(0);
});
+
+ it("should return 0 for solarConsumption if PV is null", function () {
+ site.P_PV = null;
+ site.P_Load = -1000;
+ var result = subject.parseAutonomyChart(service, site).dimensions[2];
+
+ expect(result.name).toBe(subject.solarConsumptionId);
+ expect(result.value).toBe(0);
+ });
+
+ it("should return 100 for solarConsumption if Load is higher than solar power", function () {
+ site.P_PV = 500;
+ site.P_Load = -1500;
+ var result = subject.parseAutonomyChart(service, site).dimensions[2];
+
+ expect(result.name).toBe(subject.solarConsumptionId);
+ expect(result.value).toBe(100);
+ });
+
+ it("should return 50 for solarConsumption if Load is half than solar power", function () {
+ site.P_PV = 3000;
+ site.P_Load = -1500;
+ var result = subject.parseAutonomyChart(service, site).dimensions[2];
+
+ expect(result.name).toBe(subject.solarConsumptionId);
+ expect(result.value).toBe(50);
+ });
});
describe("fronius parsing for energy", function () {