Skip to content

Commit

Permalink
Fix a small test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusRumpf committed Oct 16, 2015
1 parent d4fd23b commit bfb5bc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/lifx/packet.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ Packet.headerToBuffer = function(obj) {
buf.writeUInt8(frameAddressDescription, offset);
offset += 1;

buf.writeUInt8(obj.sequence, offset);
if (typeof obj.sequence === 'number') {
buf.writeUInt8(obj.sequence, offset);
}
offset += 1;

// Protocol header
Expand Down
3 changes: 2 additions & 1 deletion test/unit/packet-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ suite('Packet', () => {
tagged: true,
protocolVersion: 1024,
source: '3e805108',
type: 2
type: 2,
sequence: 0
};
let parsed = Packet.headerToBuffer(obj);
assert.isTrue(parsed.equals(expectedResult));
Expand Down

0 comments on commit bfb5bc1

Please sign in to comment.