@@ -309,6 +309,57 @@ public function testRoundtripWithKeychain(): void
309309 $ this ->assertSame (36 , $ parsed ->keychains [0 ]->stickerId );
310310 }
311311
312+ // -----------------------------------------------------------------------
313+ // toGenCode — keychain paintKit
314+ // -----------------------------------------------------------------------
315+
316+ public function testToGenCodeKeychainWithPaintKitAppendsPaintKit (): void
317+ {
318+ $ item = new ItemPreviewData (
319+ defindex: 1355 ,
320+ paintindex: 0 ,
321+ paintseed: 0 ,
322+ paintwear: 0.0 ,
323+ keychains: [new Sticker (slot: 0 , stickerId: 37 , wear: 0.0 , paintKit: 929 )],
324+ );
325+ $ code = GenCode::toGenCode ($ item , '' );
326+ $ tokens = explode (' ' , $ code );
327+ // last three tokens should be: 37 0 929
328+ $ this ->assertSame ('37 ' , $ tokens [count ($ tokens ) - 3 ]);
329+ $ this ->assertSame ('0 ' , $ tokens [count ($ tokens ) - 2 ]);
330+ $ this ->assertSame ('929 ' , $ tokens [count ($ tokens ) - 1 ]);
331+ }
332+
333+ public function testToGenCodeKeychainWithoutPaintKitNoExtraToken (): void
334+ {
335+ $ item = new ItemPreviewData (
336+ defindex: 7 ,
337+ paintindex: 0 ,
338+ paintseed: 0 ,
339+ paintwear: 0.0 ,
340+ keychains: [new Sticker (slot: 0 , stickerId: 36 , wear: 0.0 )],
341+ );
342+ $ code = GenCode::toGenCode ($ item , '' );
343+ $ tokens = explode (' ' , $ code );
344+ // last two tokens should be: 36 0
345+ $ this ->assertSame ('36 ' , $ tokens [count ($ tokens ) - 2 ]);
346+ $ this ->assertSame ('0 ' , $ tokens [count ($ tokens ) - 1 ]);
347+ }
348+
349+ // -----------------------------------------------------------------------
350+ // genCodeFromLink — sticker slab
351+ // -----------------------------------------------------------------------
352+
353+ public function testGenCodeFromLinkSlabUrlEndsWithPaintKit (): void
354+ {
355+ $ slabUrl = 'steam://run/730//+csgo_econ_action_preview%20819181994A8BA181A982B189E981F181238086898191A4E1208698F309C9 ' ;
356+ $ code = GenCode::genCodeFromLink ($ slabUrl , '' );
357+ $ tokens = explode (' ' , $ code );
358+ $ this ->assertSame ('37 ' , $ tokens [count ($ tokens ) - 3 ]);
359+ $ this ->assertSame ('0 ' , $ tokens [count ($ tokens ) - 2 ]);
360+ $ this ->assertSame ('929 ' , $ tokens [count ($ tokens ) - 1 ]);
361+ }
362+
312363 // -----------------------------------------------------------------------
313364 // genCodeFromLink
314365 // -----------------------------------------------------------------------
0 commit comments