diff options
author | Richard Wall <richard@largo> | 2010-08-29 19:24:25 +0100 |
---|---|---|
committer | Richard Wall <richard@largo> | 2010-08-29 19:24:25 +0100 |
commit | 3c28be95136220398ff8b5b808742c8028876950 (patch) | |
tree | d74183c936452c92915be084b1986066c6972d3b | |
parent | 24751968187f59cdbb45a17b37f188fc9e169c1c (diff) |
A first rrdquery test
-rw-r--r-- | jarmon/jarmon.test.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/jarmon/jarmon.test.js b/jarmon/jarmon.test.js index 229b9a8..7a2d6ec 100644 --- a/jarmon/jarmon.test.js +++ b/jarmon/jarmon.test.js @@ -49,7 +49,7 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) { name: "jarmon.RrdQuery", setUp: function() { - this.d = new jarmon.downloadBinary('simple.rrd') + this.d = new jarmon.downloadBinary('build/test.rrd') .addCallback( function(self, binary) { try { @@ -86,12 +86,20 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) { test_getDataSimple: function () { /** - * The starttime must be less than the endtime + * The generated rrd file should have values 0-9 at 1s intervals + * starting at 1980-01-01 00:00:00 **/ this.d.addCallback( function(self, rrd) { self.resume(function() { - Y.Assert.areEqual(1, rrd.getLastUpdate()); + var firstUpdate = new Date('1 jan 1980 00:00:00').getTime(); + var lastUpdate = firstUpdate + 10*1000; + Y.Assert.areEqual( + lastUpdate/1000, rrd.getLastUpdate()); + var q = new jarmon.RrdQuery(rrd, ''); + var data = q.getData(firstUpdate, lastUpdate); + Y.Assert.areEqual( + 0, data.data[0][1]); }); }, this); this.wait(); |