Browse Source

Add test for wrong password

fix/pass
Sheogorath 6 years ago
parent
commit
6ffedcd74e
No known key found for this signature in database GPG Key ID: 1F05CC3635CDDFFD
  1. 23
      test/command_pass.js

23
test/command_pass.js

@ -29,6 +29,29 @@ describe("PASS OK", function () {
user = server.getUserlist()["some_nick"] user = server.getUserlist()["some_nick"]
assert.equal(user["registered"], true) assert.equal(user["registered"], true)
done() done()
})
it("should end connection on wrong password", function (done) {
const server = IRCServer.create({
password: "itsJustATest"
})
let mockedSock = new EventEmitter()
mockedSock.address = function() {
return { port: 12346, family: 'IPv4', address: '127.0.0.1' }
}
mockedSock.write = function (data) {
return
}
mockedSock.destroy = function () {
// connection has to be destroyed
done("")
}
server.emit("connection", mockedSock)
mockedSock.emit('data', Buffer.from("PASS wrongpassword\r\n", "ascii"))
}) })
}) })
Loading…
Cancel
Save