ketracel/spec/ngircd_harness_spec.moon

52 lines
1.2 KiB
Plaintext
Raw Normal View History

2019-12-25 20:38:19 +00:00
irce = require "irce"
socket = require "socket"
2019-12-25 22:48:28 +00:00
test = require "ketracel.test"
2019-12-25 20:38:19 +00:00
describe "ngircd protocol support", ->
local file
local last_msg
client = socket.tcp!
client\settimeout 1
irc = irce.new!
irc\set_send_func (message) =>
last_msg = message
print "[server] > " .. message
client\send message
irc\load_module require "irce.modules.ngircd"
setup ->
print "got here"
file = io.popen "ngircd -n -f ./spec/ngircd.conf", "r"
teardown ->
with io.popen "killall ngircd", "r"
\close!
with file
print \read "*all"
\close!
it "actually is running ngircd", ->
with io.popen "pstree"
data = \read "*all"
assert.truthy string.find data, "ngircd"
it "registers", ->
bursted = false
irc\set_callback "376", =>
bursted = true
client\connect "127.0.0.1", 6667
irc\REGISTER "hunter2", "kc-test", "0.0.1", "ketracel.akua", "test", "31"
while not bursted
msg = client\receive!
print "[server] " .. msg
irc\process msg
2019-12-25 22:48:28 +00:00
@irc\clear_callback "376"
2019-12-25 20:38:19 +00:00
2019-12-25 22:48:28 +00:00
it "can use the Client class", ->
cli = test.Client "test_user"
cli\wait_for "005"
cli\quit!