diff --git a/package.json b/package.json index 7920b241..3a2a8e9e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "url": "https://github.com/erming/shout.git" }, "scripts": { - "start": "node index" + "start": "node index", + "test": "NODE_ENV=test mocha test/**/*.js" }, "keywords": [ "browser", @@ -40,6 +41,7 @@ "grunt": "~0.4.5", "grunt-contrib-uglify": "~0.5.0", "grunt-contrib-watch": "^0.6.1", - "handlebars": "^2.0.0" + "handlebars": "^2.0.0", + "mocha": "~2.0.1" } } diff --git a/test/plugins/link.js b/test/plugins/link.js new file mode 100644 index 00000000..6cef635d --- /dev/null +++ b/test/plugins/link.js @@ -0,0 +1,37 @@ +var assert = require('assert'); + +var util = require('../util'); +var link = require('../../src/plugins/irc-events/link.js'); + +describe('Link plugin', function() { + before(function(done) { + this.app = util.createWebserver(); + this.connection = this.app.listen(9002, done); + }); + + after(function(done) { + this.connection.close(done); + }); + + beforeEach(function() { + this.irc = util.createClient(); + this.network = util.createNetwork(); + }); + + it('should be able to fetch basic information about URLs', function(done) { + var plugin = link.call(this.irc, this.irc, this.network); + + this.app.get('/basic', function(req, res) { + res.send('