diff options
author | Richard Wall <richard@largo> | 2010-08-28 22:34:26 +0100 |
---|---|---|
committer | Richard Wall <richard@largo> | 2010-08-28 22:34:26 +0100 |
commit | 333dfba10d99e5a2eec391c2481156329e2949dc (patch) | |
tree | f890b13f90e2d2b8dc0a3058542accc01e921846 /jarmon/jarmon.test.js | |
parent | 64f965d74374f3a15342bf6e807ac50513a69f68 (diff) |
the start of a builder of simple, testable rrd files
Diffstat (limited to 'jarmon/jarmon.test.js')
-rw-r--r-- | jarmon/jarmon.test.js | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/jarmon/jarmon.test.js b/jarmon/jarmon.test.js index 86243b4..229b9a8 100644 --- a/jarmon/jarmon.test.js +++ b/jarmon/jarmon.test.js @@ -48,19 +48,54 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) { Y.Test.Runner.add(new Y.Test.Case({ name: "jarmon.RrdQuery", + setUp: function() { + this.d = new jarmon.downloadBinary('simple.rrd') + .addCallback( + function(self, binary) { + try { + return new RRDFile(binary); + } catch(e) { + console.log(e); + } + }, this) + .addErrback( + function(ret) { + console.log(ret); + }); + }, + test_getDataTimeRangeOverlapError: function () { /** * The starttime must be less than the endtime **/ - var rq = new jarmon.RrdQuery({}, ''); - var error = null; - try { - rq.getData(1, 0); - } catch(e) { - error = e; - } - Y.Assert.isInstanceOf(jarmon.TimeRangeError, error); - } + this.d.addCallback( + function(self, rrd) { + self.resume(function() { + var rq = new jarmon.RrdQuery(self.rrd, ''); + var error = null; + try { + rq.getData(1, 0); + } catch(e) { + error = e; + } + Y.Assert.isInstanceOf(jarmon.TimeRangeError, error); + }); + }, this); + this.wait(); + }, + + test_getDataSimple: function () { + /** + * The starttime must be less than the endtime + **/ + this.d.addCallback( + function(self, rrd) { + self.resume(function() { + Y.Assert.areEqual(1, rrd.getLastUpdate()); + }); + }, this); + this.wait(); + }, })); |