]> git.cworth.org Git - obsolete/notmuch-web/blob - node_modules/express/node_modules/qs/support/expresso/test/assert.test.js
Install the "express" node module via npm
[obsolete/notmuch-web] / node_modules / express / node_modules / qs / support / expresso / test / assert.test.js
1
2 /**
3  * Module dependencies.
4  */
5
6 var assert = require('assert');
7
8 module.exports = {
9     'assert.eql()': function(){
10         assert.equal(assert.deepEqual, assert.eql);
11     },
12     
13     'assert.type()': function(){
14         assert.type('foobar', 'string');
15         assert.type(2, 'number');
16         assert.throws(function(){
17             assert.type([1,2,3], 'string');
18         });
19     },
20     
21     'assert.includes()': function(){
22         assert.includes('some random string', 'dom');
23         assert.throws(function(){
24            assert.include('some random string', 'foobar');
25         });
26
27         assert.includes(['foo', 'bar'], 'bar');
28         assert.includes(['foo', 'bar'], 'foo');
29         assert.includes([1,2,3], 3);
30         assert.includes([1,2,3], 2);
31         assert.includes([1,2,3], 1);
32         assert.throws(function(){
33             assert.includes(['foo', 'bar'], 'baz');
34         });
35         
36         assert.throws(function(){
37             assert.includes({ wrong: 'type' }, 'foo');
38         });
39     },
40     
41     'assert.isNull()': function(){
42         assert.isNull(null);
43         assert.throws(function(){
44             assert.isNull(undefined);
45         });
46         assert.throws(function(){
47             assert.isNull(false);
48         });
49     },
50     
51     'assert.isUndefined()': function(){
52         assert.isUndefined(undefined);
53         assert.throws(function(){
54             assert.isUndefined(null);
55         });
56         assert.throws(function(){
57             assert.isUndefined(false);
58         });
59     },
60     
61     'assert.isNotNull()': function(){
62         assert.isNotNull(false);
63         assert.isNotNull(undefined);
64         assert.throws(function(){
65             assert.isNotNull(null);
66         });
67     },
68     
69     'assert.isDefined()': function(){
70         assert.isDefined(false);
71         assert.isDefined(null);
72         assert.throws(function(){
73             assert.isDefined(undefined);
74         });
75     },
76     
77     'assert.match()': function(){
78         assert.match('foobar', /foo(bar)?/);
79         assert.throws(function(){
80             assert.match('something', /rawr/);
81         });
82     },
83     
84     'assert.length()': function(){
85         assert.length('test', 4);
86         assert.length([1,2,3,4], 4);
87         assert.throws(function(){
88             assert.length([1,2,3], 4);
89         });
90     }
91 };