summaryrefslogtreecommitdiff
path: root/jarmon/jarmon.test.js
blob: b6ee0358ddf32d42192f52025f18c1b4f0961a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Copyright (c) 2010 Richard Wall <richard (at) the-moon.net>
 * See LICENSE for details.
 *
 * Unit tests for Jarmon
 **/

YUI({ logInclude: { TestRunner: true } }).use('console', 'test', function(Y) {
    Y.Test.Runner.add(new Y.Test.Case({
        name: "jarmon.downloadBinary",

        setUp : function () {
        },

        tearDown : function () {
        },

        test_urlNotFound: function () {
            var d = new jarmon.downloadBinary('non-existent-file.html');
            d.addBoth(
                function(self, ret) {
                    self.resume(function() {
                        Y.Assert.isInstanceOf(Error, ret);
                        Y.Assert.areEqual(404, ret.message);
                    });
                }, this);

            this.wait();
        },
    }));

    //initialize the console
    var yconsole = new Y.Console({
        newestOnTop: false,
        width:'600px'
    });
    yconsole.render('#log');

    //run all tests
    Y.Test.Runner.run();
});