diff options
author | Richard Wall <richard@aziz> | 2010-08-25 21:06:07 +0100 |
---|---|---|
committer | Richard Wall <richard@aziz> | 2010-08-25 21:06:07 +0100 |
commit | a741b9e561512e258fe4a589ac074c548eb37e3a (patch) | |
tree | d62914d7ffa56bc6095c786d53e6570458f642db | |
parent | 4afe231bc8371560cc87f6865d74f052691ea582 (diff) |
Add a test for successful binary download
-rw-r--r-- | jarmon/jarmon.test.js | 22 | ||||
-rw-r--r-- | testfile.bin | bin | 0 -> 1 bytes |
2 files changed, 22 insertions, 0 deletions
diff --git a/jarmon/jarmon.test.js b/jarmon/jarmon.test.js index b6ee035..4a5c273 100644 --- a/jarmon/jarmon.test.js +++ b/jarmon/jarmon.test.js @@ -15,6 +15,10 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) { }, test_urlNotFound: function () { + /** + * When url cannot be found, the deferred should errback with status + * 404. + **/ var d = new jarmon.downloadBinary('non-existent-file.html'); d.addBoth( function(self, ret) { @@ -26,6 +30,24 @@ YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) { this.wait(); }, + + test_urlFound: function () { + /** + * When url is found, the deferred should callback with an instance + * of javascriptrrd.BinaryFile + **/ + var d = new jarmon.downloadBinary('testfile.bin'); + d.addBoth( + function(self, ret) { + self.resume(function() { + Y.Assert.isInstanceOf(BinaryFile, ret); + Y.Assert.areEqual(String.fromCharCode(0), ret.getRawData()); + }); + }, this); + + this.wait(); + }, + })); //initialize the console diff --git a/testfile.bin b/testfile.bin Binary files differnew file mode 100644 index 0000000..f76dd23 --- /dev/null +++ b/testfile.bin |