mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
test passing: get kicked for no credentials in online mode
This commit is contained in:
parent
73e274e5c9
commit
46d862b1c4
2 changed files with 26 additions and 5 deletions
|
@ -11,8 +11,12 @@ Parse and serialize minecraft packets, plus authentication and encryption.
|
|||
- Supports encryption
|
||||
- Supports online mode
|
||||
- Supports offline mode
|
||||
* Send keep-alive packet at the correct interval.
|
||||
* Reasonable amount of test coverage (TODO #3)
|
||||
* Respond to keep-alive packets.
|
||||
* Test coverage
|
||||
- encryption
|
||||
- authentication/online mode
|
||||
- offline mode
|
||||
- initialization packets
|
||||
* Optimized for rapidly staying up to date with Minecraft protocol updates.
|
||||
|
||||
## Minecraft Compatibility
|
||||
|
|
23
test/test.js
23
test/test.js
|
@ -85,10 +85,10 @@ describe("minecraft protocol", function() {
|
|||
}
|
||||
mcServer.on('line', onLine);
|
||||
mcServer.on('line', function(line) {
|
||||
process.stderr.write('.');
|
||||
//process.stderr.write('.');
|
||||
// uncomment this line when debugging for more insight as to what is
|
||||
// happening on the minecraft server
|
||||
//console.error("[MC]", line);
|
||||
console.error("[MC]", line);
|
||||
});
|
||||
function onLine(line) {
|
||||
if (/\[INFO\] Done/.test(line)) {
|
||||
|
@ -180,6 +180,23 @@ describe("minecraft protocol", function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
it("emits error when no credentials supplied in online mode");
|
||||
it("gets kicked when no credentials supplied in online mode", function(done) {
|
||||
startServer({ 'online-mode': 'true' }, function() {
|
||||
var client = mc.createClient({
|
||||
username: process.env.MC_USERNAME,
|
||||
});
|
||||
var gotKicked = false;
|
||||
client.on('packet', function(packet) {
|
||||
if (packet.id === 0xff) {
|
||||
assert.strictEqual(packet.reason, "Failed to verify username!");
|
||||
gotKicked = true;
|
||||
}
|
||||
});
|
||||
client.on('end', function() {
|
||||
assert.ok(gotKicked);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it("survives for " + SURVIVE_TIME + "ms");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue