diff --git a/README.md b/README.md index 0146cc1..73c6bff 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/test/test.js b/test/test.js index 9d5a093..9e368f1 100644 --- a/test/test.js +++ b/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"); });