mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
test passing: correct reason for kicking clients when shutting down
This commit is contained in:
parent
2e75851fd6
commit
cbb5be36b9
1 changed files with 31 additions and 1 deletions
32
test/test.js
32
test/test.js
|
@ -390,5 +390,35 @@ describe("mc-server", function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it("gives correct reason for kicking clients when shutting down");
|
it("gives correct reason for kicking clients when shutting down", function(done) {
|
||||||
|
var server = mc.createServer({ 'online-mode': false, });
|
||||||
|
var count = 2;
|
||||||
|
server.on('login', function(client) {
|
||||||
|
client.on('end', function(reason) {
|
||||||
|
assert.strictEqual(reason, 'ServerShutdown');
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
client.write(0x01, {
|
||||||
|
entityId: client.id,
|
||||||
|
levelType: 'default',
|
||||||
|
gameMode: 1,
|
||||||
|
dimension: 0,
|
||||||
|
difficulty: 2,
|
||||||
|
maxPlayers: server.maxPlayers
|
||||||
|
});
|
||||||
|
});
|
||||||
|
server.on('close', function() {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
server.on('listening', function() {
|
||||||
|
var client = mc.createClient({ username: 'lalalal', });
|
||||||
|
client.on(0x01, function() {
|
||||||
|
server.close();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function resolve() {
|
||||||
|
count -= 1;
|
||||||
|
if (count <= 0) done();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue