Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Sidorov authored and sidorares committed Aug 20, 2019
1 parent af2db86 commit 2b435f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
1 change: 0 additions & 1 deletion lib/packets/resultset_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ResultSetHeader {
const encoding = connection.serverEncoding;
const flags = connection._handshakePacket.capabilityFlags;
const isSet = function(flag) {
console.log('isSet?', flag, ClientConstants[flag]);
return flags & ClientConstants[flag];
};
if (packet.buffer[packet.offset] !== 0) {
Expand Down
32 changes: 18 additions & 14 deletions test/unit/packets/test-ok-sessiontrack.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const assert = require('assert');
const Packet = require('./lib/packets/packet');
const ResultSetHeader = require('./lib/packets/resultset_header.js');
const Packet = require('../../../lib/packets/packet');
const ResultSetHeader = require('../../../lib/packets/resultset_header.js');
const clientConstants = require('../../../lib/constants/client');

const mockConnection = {
Expand All @@ -18,17 +18,21 @@ const mkpacket = str => {
return new Packet(0, buf, 0, buf.length);
};

const packet2 = mkpacket(
'15 00 00 01 00 01 fc 41 0d 03 40 00 00 00 0a 14 08 fe 1a 54 1c 06 00 00 00'
);
// regression examples from https://github.com/sidorares/node-mysql2/issues/989

const unknownTypeSession = hexbuf(
`1b 00 00 01
00
01 fe 65 96 fc 02 00 00 00 00 03 40 00 00 00 0a 14 08 fe 60 63 9b 05 00 00 00
`
);
assert.doesNotThrow(() => {
const packet = mkpacket(
`1b 00 00 01
00
01 fe 65 96 fc 02 00 00 00 00 03 40 00 00 00 0a 14 08 fe 60 63 9b 05 00 00 00
`
);
new ResultSetHeader(packet, mockConnection);
});

const ResultSetHeader = mkpacket('./lib/packets/resultset_header.js');
const rs = new ResultSetHeader(p, mockConnection);
console.log(rs);
assert.doesNotThrow(() => {
const packet = mkpacket(
`13 00 00 01 00 01 00 02 40 00 00 00 0a 14 08 fe 18 25 e7 06 00 00 00`
);
new ResultSetHeader(packet, mockConnection);
});

0 comments on commit 2b435f1

Please sign in to comment.