|
1 | 1 | var should = require("chai").should(); |
2 | 2 | var exec = require("child_process").exec; |
| 3 | +var del = require("del"); |
| 4 | + |
| 5 | +require("./lib/testserver.js"); |
3 | 6 |
|
4 | 7 | describe("$ w3c-validator invalid", function() { |
5 | | - it("should fail because of invalid url"); |
6 | | - it("should exit with error code '1'"); |
| 8 | + var _error; |
| 9 | + var _stdout; |
| 10 | + var _stderr; |
| 11 | + |
| 12 | + before(function(done) { |
| 13 | + var cmd = exec("node ./lib/W3CValidator.js illegal", function(error, stdout, stderr) { |
| 14 | + _error = error; |
| 15 | + _stdout = stdout; |
| 16 | + _stderr = stderr; |
| 17 | + done(); |
| 18 | + }); |
| 19 | + }); |
| 20 | + |
| 21 | + it("should fail because of invalid url", function() { |
| 22 | + _stderr.should.not.be.empty; |
| 23 | + }); |
| 24 | + |
| 25 | + it("should exit with error code '1'", function() { |
| 26 | + _error.code.should.equal(1); |
| 27 | + }); |
7 | 28 | }); |
8 | 29 |
|
9 | 30 | describe("$ w3c-validator 127.0.0.1", function() { |
10 | | - it("should not throw any errors"); |
11 | | - it("should return success message"); |
| 31 | + this.timeout(10000); |
| 32 | + |
| 33 | + var _error; |
| 34 | + var _stdout; |
| 35 | + var _stderr; |
| 36 | + |
| 37 | + before(function(done) { |
| 38 | + var cmd = exec("node ./lib/W3CValidator.js 127.0.0.1", function(error, stdout, stderr) { |
| 39 | + _error = error; |
| 40 | + _stdout = stdout; |
| 41 | + _stderr = stderr; |
| 42 | + done(); |
| 43 | + }); |
| 44 | + }); |
| 45 | + |
| 46 | + it("should not throw any errors", function() { |
| 47 | + _stderr.should.be.empty; |
| 48 | + should.equal(_error, null); |
| 49 | + }); |
| 50 | + |
| 51 | + it("should return success message", function() { |
| 52 | + _stdout.should.not.be.empty; |
| 53 | + }); |
12 | 54 | }); |
13 | 55 |
|
14 | 56 | describe("$ w3c-validator --log 127.0.0.1", function() { |
15 | | - it("should create a text file"); |
| 57 | + |
| 58 | + var _error; |
| 59 | + var _stdout; |
| 60 | + var _stderr; |
| 61 | + |
| 62 | + after(function() { |
| 63 | + del.sync(["./*.txt"]) |
| 64 | + }); |
| 65 | + |
| 66 | + before(function(done) { |
| 67 | + var cmd = exec("node ./lib/W3CValidator.js --log", function(error, stdout, stderr) { |
| 68 | + _error = error; |
| 69 | + _stdout = stdout; |
| 70 | + _stderr = stderr; |
| 71 | + done(); |
| 72 | + }); |
| 73 | + }); |
| 74 | + |
| 75 | + it("should create a log file"); |
| 76 | + |
16 | 77 | }); |
17 | 78 |
|
18 | 79 | describe("$ w3c-validator --query 127.0.0.1", function() { |
|
0 commit comments