Browse Source
Feature: Add function to recieve userlist
feature/getUserlist
Sheogorath
6 years ago
No known key found for this signature in database
GPG Key ID: 1F05CC3635CDDFFD
2 changed files with
15 additions and
1 deletions
-
src/server.js
-
test/command_create.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 |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -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()) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |