1 | var grunt = require('grunt'); |
---|
2 | |
---|
3 | /* |
---|
4 | ======== A Handy Little Nodeunit Reference ======== |
---|
5 | https://github.com/caolan/nodeunit |
---|
6 | |
---|
7 | Test methods: |
---|
8 | test.expect(numAssertions) |
---|
9 | test.done() |
---|
10 | Test assertions: |
---|
11 | test.ok(value, [message]) |
---|
12 | test.equal(actual, expected, [message]) |
---|
13 | test.notEqual(actual, expected, [message]) |
---|
14 | test.deepEqual(actual, expected, [message]) |
---|
15 | test.notDeepEqual(actual, expected, [message]) |
---|
16 | test.strictEqual(actual, expected, [message]) |
---|
17 | test.notStrictEqual(actual, expected, [message]) |
---|
18 | test.throws(block, [error], [message]) |
---|
19 | test.doesNotThrow(block, [error], [message]) |
---|
20 | test.ifError(value) |
---|
21 | */ |
---|
22 | |
---|
23 | var fs = require('fs'); |
---|
24 | exports['curl'] = { |
---|
25 | setUp: function(done) { |
---|
26 | // setup here |
---|
27 | done(); |
---|
28 | }, |
---|
29 | 'js': function(test) { |
---|
30 | test.expect(1); |
---|
31 | // tests here |
---|
32 | var expectedContent = grunt.file.read('expected/file.js'), |
---|
33 | actualContent = grunt.file.read('actual/file.js'); |
---|
34 | test.equal(actualContent, expectedContent, 'should return the correct value.'); |
---|
35 | test.done(); |
---|
36 | }, |
---|
37 | 'zip': function(test) { |
---|
38 | test.expect(1); |
---|
39 | // tests here |
---|
40 | var expectedContent = fs.readFileSync('expected/file.zip', 'binary'), |
---|
41 | actualContent = fs.readFileSync('actual/file.zip', 'binary'); |
---|
42 | test.equal(actualContent, expectedContent, 'should return the correct value.'); |
---|
43 | test.done(); |
---|
44 | }, |
---|
45 | 'nonExistingDomain': function(test) { |
---|
46 | test.expect(1); |
---|
47 | test.throws(function() { |
---|
48 | fs.readFileSync('actual/nonexistent-domain', 'binary'); |
---|
49 | }); |
---|
50 | test.done(); |
---|
51 | }, |
---|
52 | 'nonExistingFile': function(test) { |
---|
53 | test.expect(1); |
---|
54 | test.throws(function() { |
---|
55 | fs.readFileSync('actual/nonexistent-file', 'binary'); |
---|
56 | }); |
---|
57 | test.done(); |
---|
58 | } |
---|
59 | }; |
---|