Created
January 1, 2014 18:40
-
-
Save Havvy/8210324 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sinon = require('sinon'); | |
| var assert = require('better-assert'); | |
| var equal = require('deep-eql'); | |
| var inspect = require('util').inspect; | |
| var format = require('util').format; | |
| var debug = false; | |
| var logfn = debug ? console.log.bind(console) : function () {}; | |
| var logger = {debug: logfn, info: logfn, notice: logfn, warn: logfn, error: logfn}; | |
| var channel = "#test"; | |
| var nickname = 'testbot'; | |
| var OutputSocket = require('../lib/output-socket'); | |
| var EventEmitter = require('events').EventEmitter; | |
| describe('IRC Output Sockets', function () { | |
| var socket, out, messageHandler; | |
| beforeEach(function () { | |
| var messageHandler = new EventEmitter(); | |
| socket = { raw: sinon.stub() }; | |
| out = new OutputSocket(socket, messageHandler, logger); | |
| }); | |
| describe('can join channels', function () { | |
| it('and promise you it joined the channel', function (done) { | |
| var joinmsg = {}; | |
| out.raw.andCallFake(function () { | |
| messageHandler.emit('join', joinmsg); | |
| }); | |
| out.join(channel) | |
| .then(function (join) { | |
| try { | |
| assert(equal(join, joinmsg)); | |
| } catch (e) { | |
| done(e); | |
| } | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment