Browse Source

Feature: Add function to recieve userlist

feature/getUserlist
Sheogorath 5 years ago
parent
commit
b0cd18967b
No known key found for this signature in database GPG Key ID: 1F05CC3635CDDFFD
  1. 8
      src/server.js
  2. 8
      test/command_create.js

8
src/server.js

@ -15,7 +15,7 @@ let server = {}
let registeredUserlist = require("../src/userlist.js")
server.create = function create() {
return net.createServer((socket) => {
let server = net.createServer((socket) => {
const user = new User(socket)
socket.on('data', function (data) {
let tokenized = data.toString("ascii").split("\r\n")[0].split(" ")
@ -54,6 +54,12 @@ server.create = function create() {
console.error(err);
throw err;
});
server.getUserlist = function() {
return registeredUserlist
}
return server
}

8
test/command_create.js

@ -9,4 +9,12 @@ describe('IRC server', function () {
assert.equal(server.eventNames().toString(), ["connection", "error"].toString())
})
})
describe('#getUserlist()', function () {
it("should return a socket server", function () {
const server = IRCServer.create()
assert.equal(server.getUserlist().toString(), {}.toString())
})
})
})
Loading…
Cancel
Save