Skip to content

Commit

Permalink
test: add more tests for channel model
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlucas committed Mar 21, 2016
1 parent c704d52 commit 53a740b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/models/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test('Channel - type channel', (t) => {
t.equal(chan.autoJoin, false, 'autoJoin is correct')
t.equal(chan.from, null, 'from is correct')
t.equal(chan._connection, conn, '_connection is correct')
t.equal(chan.getConnection(), conn, 'Channel#getConnection()')
t.equal(chan.ele, '.channel-container', 'ele is correct')
t.equal(chan.active, false, 'active is correct')
t.type(chan.colorMap, Map)
Expand Down Expand Up @@ -126,6 +127,26 @@ test('Channel - type private', (t) => {
t.equal(chan.users.size, 1, 'user.size is 1')
t.equal(chan.names.length, 1, 'names.length is 1')
t.equal(chan._onlyNames.length, 1, '_onlyNames.length is 1')

let orig = chan.addMessage
chan.addMessage = function(opts) {
chan.addMessage = orig
t.equal(opts.message, 'Topic: BISCUITS')
t.equal(opts.type, 'info')
t.pass('called addMessage')
}
chan.setTopic('BISCUITS')
t.equal(chan.topic, 'BISCUITS', 'topic')

orig = chan.setMode
chan.addMessage = function(opts) {
chan.addMessage = orig
t.equal(opts.message, 'Mode is +ab')
t.equal(opts.type, 'info')
t.pass('called addMessage')
}
chan.setMode('+ab')
t.equal(chan.mode, '+ab', 'mode')
t.end()
})

Expand Down

0 comments on commit 53a740b

Please sign in to comment.