-
-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial code for session_track unit test
- Loading branch information
Andrey Sidorov
committed
Aug 19, 2019
1 parent
6dd8a4d
commit af2db86
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const Packet = require('./lib/packets/packet'); | ||
const ResultSetHeader = require('./lib/packets/resultset_header.js'); | ||
const clientConstants = require('../../../lib/constants/client'); | ||
|
||
const mockConnection = { | ||
config: {}, | ||
serverEncoding: 'utf8', | ||
_handshakePacket: { | ||
capabilityFlags: clientConstants.PROTOCOL_41 + clientConstants.SESSION_TRACK | ||
} | ||
}; | ||
|
||
const mkpacket = str => { | ||
const buf = Buffer.from(str.split(/[ \n]+/).join(''), 'hex'); | ||
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' | ||
); | ||
|
||
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 | ||
` | ||
); | ||
|
||
const ResultSetHeader = mkpacket('./lib/packets/resultset_header.js'); | ||
const rs = new ResultSetHeader(p, mockConnection); | ||
console.log(rs); |