From 16eacfa961d2a2d80534e95eba83010ed6ab01b4 Mon Sep 17 00:00:00 2001 From: yawnt Date: Sat, 3 Aug 2013 16:54:48 +0200 Subject: [PATCH] [test] started writing tests --- test/lib-caronte-test.js | 27 +++++++++++++++++++++++++++ test/truth-test.js | 8 -------- 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 test/lib-caronte-test.js delete mode 100644 test/truth-test.js diff --git a/test/lib-caronte-test.js b/test/lib-caronte-test.js new file mode 100644 index 0000000..8358c5f --- /dev/null +++ b/test/lib-caronte-test.js @@ -0,0 +1,27 @@ +var caronte = require('../lib/caronte'), + expect = require('expect.js'); + +describe('lib/caronte.js', function() { + describe('#createProxyServer', function() { + it('should throw without options', function() { + var error; + try { + caronte.createProxyServer(); + } catch(e) { + error = e; + } + + expect(error).to.be.an(Error); + }) + + it('should return an object otherwise', function() { + var obj = caronte.createProxyServer({ + target: 'http://www.google.com:80' + }); + + expect(obj.web).to.be.a(Function); + expect(obj.ws).to.be.a(Function); + expect(obj.listen).to.be.a(Function); + }); + }); +}); diff --git a/test/truth-test.js b/test/truth-test.js deleted file mode 100644 index 437df34..0000000 --- a/test/truth-test.js +++ /dev/null @@ -1,8 +0,0 @@ -var caronte = require('../'), - expect = require('expect.js'); - -describe('the truthness', function() { - it('should be true', function() { - expect(true).to.be(true); - }) -});