You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
755 B
24 lines
755 B
const assert = require('assert');
|
|
const EventEmitter = require('events');
|
|
const IRCServer = require("../src/server.js");
|
|
|
|
describe("PASS OK", function () {
|
|
it("should handle a PASS command -> PASS some_passwd", function (done) {
|
|
const server = IRCServer.create()
|
|
let mockedSock = new EventEmitter()
|
|
|
|
|
|
mockedSock.destroy = function () {
|
|
done("Destroyed socket without answering")
|
|
}
|
|
|
|
server.emit("connection", mockedSock)
|
|
mockedSock.emit('data', Buffer.from("PASS some_pass\r\n", "ascii"))
|
|
mockedSock.emit('data', Buffer.from("NICK some_nick\r\n", "ascii"))
|
|
|
|
user = server.getUserlist()["some_nick"]
|
|
assert.equal("some_pass", user["password"])
|
|
done()
|
|
|
|
})
|
|
})
|