ketracel/spec/ngircd_channel_spec.moon

28 lines
784 B
Plaintext

Channel = require "irce.modules.ngircd.channel"
describe "Channel", ->
it "requires a channel name", ->
assert.has.errors -> Channel {}
it "lets you create a channel", ->
assert.truthy Channel name: "#butts"
it "lets you set modes", ->
with Channel name: "#butts"
\add_mode "p"
assert .modes[1] == "p"
\del_mode "p"
assert #.modes == 0
it "requires channel membership to give hats", ->
with Channel name: "#butts"
assert.has.errors -> \add_hat "cadey", "@"
assert.has.errors -> \del_hat "cadey", "@"
it "lets you give people hats", ->
with Channel name: "#butts", members: {cadey: {}}
\add_hat "cadey", "@"
assert .members.cadey[1] == "o"
\del_hat "cadey", "@"
assert #.members.cadey == 0