File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ok } from "assert" ;
2+ import { parse } from "../src" ;
3+ import { getEventString } from "./helpers/getEventString" ;
4+ import { counterTerroristTeam } from "./helpers/teams" ;
5+
6+ describe ( "steam id" , ( ) => {
7+ const event = {
8+ player : {
9+ kind : "player" ,
10+ entityId : 93 ,
11+ steamId : "76561198191236195" ,
12+ name : "PlayerName" ,
13+ team : counterTerroristTeam ,
14+ } ,
15+ how : "world" ,
16+ } ;
17+
18+ it ( "should correctly parse with new steam id" , ( ) => {
19+ const log = '"PlayerName<93><[U:1:230970467]><CT>" [-1117 2465 -72] committed suicide with "world"' ;
20+ const result = parse ( getEventString ( log ) ) ;
21+
22+ ok ( result !== undefined , `Failed parse log: ${ log } ` ) ;
23+
24+ expect ( result . type ) . toBe ( "suicide" ) ;
25+ expect ( result . payload ) . toMatchObject ( event ) ;
26+ } ) ;
27+
28+ it ( "should correctly parse with old steam id" , ( ) => {
29+ const log = '"PlayerName<93><STEAM_0:1:115485233><CT>" [-1117 2465 -72] committed suicide with "world"' ;
30+ const result = parse ( getEventString ( log ) ) ;
31+
32+ ok ( result !== undefined , `Failed parse log: ${ log } ` ) ;
33+
34+ expect ( result . type ) . toBe ( "suicide" ) ;
35+ expect ( result . payload ) . toMatchObject ( event ) ;
36+ } ) ;
37+ } ) ;
You can’t perform that action at this time.
0 commit comments