1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

add encoder for sayText2

This commit is contained in:
Robin Appelman 2017-09-03 14:27:17 +02:00
commit cd5d0b0e86
4 changed files with 110 additions and 10 deletions

View file

@ -0,0 +1,82 @@
import {BitStream} from 'bit-buffer';
import {assertEncoder, assertParser, getStream} from '../Packet/PacketTest';
import {EncodeSayText2, ParseSayText2} from '../../../../Parser/UserMessage/SayText2';
const data = [
3,
1,
84,
70,
95,
67,
104,
97,
116,
95,
84,
101,
97,
109,
95,
68,
101,
97,
100,
0,
79,
108,
100,
32,
66,
105,
108,
108,
121,
32,
82,
105,
108,
101,
121,
0,
91,
80,
45,
82,
69,
67,
93,
32,
83,
116,
111,
112,
32,
114,
101,
99,
111,
114,
100,
46,
0,
0,
0];
const expected = {
packetType: 'sayText2',
client: 3,
raw: 1,
kind: 'TF_Chat_Team_Dead',
from: 'Old Billy Riley',
text: '[P-REC] Stop record.'
};
suite('SayText2', () => {
test('Parse sayText2', () => {
assertParser(ParseSayText2, getStream(data), expected, 472);
});
test('Encode sayText2', () => {
assertEncoder(ParseSayText2, EncodeSayText2, expected, 472);
});
});