Add Aimedb command tests

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent 61061ee4d3
commit b678c0c551
+23
View File
@@ -0,0 +1,23 @@
const { Decoder } = require('./cmd')
function decode(req) {
const decoder = new Decoder()
decoder.write(req)
return decoder.read()
}
test('decode hello', () => {
const req = Buffer.from([
0x3e, 0xa1, 0x87, 0x30, 0x64, 0x00, 0x20, 0x00,
0x00, 0x00, 0x53, 0x44, 0x42, 0x54, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x41, 0x36, 0x39, 0x45,
0x30, 0x31, 0x41, 0x39, 0x39, 0x39, 0x39, 0x00,
])
const obj = decode(req)
expect(obj.gameId).toBe('SDBT')
expect(obj.keychipId).toBe('A69E01A9999')
})