Skip to content

Commit

Permalink
Add missing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
majektom committed Nov 1, 2020
1 parent 4e7ca5a commit 152eb55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions messages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,18 @@ describe("Message decoding unit tests", () => {
});
});

it("decode command result answer message of incorrect length", function () {
const encoder = new Encoder();
const frame = Buffer.from([
messages_impl.Commands.CommandResult,
messages.CommandResultAnswer.ResultCodes.OK,
0x00,
]);
encoder.addBytes(frame);
const message = messages.decodeMessage(encoder.frame());
assert.strictEqual(message, null);
});

it("decode message with unsupported command code", () => {
const encoder = new Encoder();
encoder.addBytes(Buffer.from([0x7e, 0x00, 0x00, 0x80, 0x00, 0x00]));
Expand Down

0 comments on commit 152eb55

Please sign in to comment.