@@ -45,14 +45,15 @@ describe("extractRevealCodes", () => {
4545 } ) as unknown as StorageAdapterLog ;
4646
4747 it ( "extracts code from a reveal log (state=IDLE)" , ( ) => {
48- // TaruchiStatus static layout: affinity(1) + state(1) + level(4) + tp(4) + traits(5) = 15 bytes
48+ // TaruchiStatus static layout: affinity(1) + state(1) + level(4) + xp(4) + tp(4) + traits(5) = 19 bytes
4949 // traits packed as uint40: flower | body<<8 | eye<<16 | mouth<<24 | equipment<<32
5050 // body=1,eye=3,mouth=5,equip=2,flower=1 -> big-endian uint40 = 0x0205030101
5151 const staticData =
5252 "0x" +
5353 "03" + // affinity: 3
5454 "01" + // state: 1 (IDLE)
5555 "00000001" + // level: 1
56+ "00000000" + // xp: 0
5657 "00000000" + // trainingPoints: 0
5758 "0205030101" ; // traits: body=1,eye=3,mouth=5,equip=2,flower=1
5859
@@ -62,29 +63,29 @@ describe("extractRevealCodes", () => {
6263 } ) ;
6364
6465 it ( "ignores non-SetRecord events" , ( ) => {
65- const staticData = "0x" + "03" + "01" + "00000001" + "00000000" + "0205030101" ;
66+ const staticData = "0x" + "03" + "01" + "00000001" + "00000000" + "00000000" + " 0205030101";
6667 const logs = [ makeLog ( "Store_DeleteRecord" , TARUCHI_STATUS_TABLE_ID , staticData ) ] ;
6768 expect ( extractRevealCodes ( logs ) ) . toEqual ( [ ] ) ;
6869 } ) ;
6970
7071 it ( "ignores wrong table ID" , ( ) => {
7172 const otherTableId = resourceToHex ( { type : "table" , namespace : "app" , name : "TaruchiCore" } ) ;
72- const staticData = "0x" + "03" + "01" + "00000001" + "00000000" + "0205030101" ;
73+ const staticData = "0x" + "03" + "01" + "00000001" + "00000000" + "00000000" + " 0205030101";
7374 const logs = [ makeLog ( "Store_SetRecord" , otherTableId , staticData ) ] ;
7475 expect ( extractRevealCodes ( logs ) ) . toEqual ( [ ] ) ;
7576 } ) ;
7677
7778 it ( "ignores non-IDLE state" , ( ) => {
7879 // state=2 (ENROLLED)
79- const staticData = "0x" + "03" + "02" + "00000001" + "00000000" + "0205030101" ;
80+ const staticData = "0x" + "03" + "02" + "00000001" + "00000000" + "00000000" + " 0205030101";
8081 const logs = [ makeLog ( "Store_SetRecord" , TARUCHI_STATUS_TABLE_ID , staticData ) ] ;
8182 expect ( extractRevealCodes ( logs ) ) . toEqual ( [ ] ) ;
8283 } ) ;
8384
8485 it ( "extracts multiple reveals from one block" , ( ) => {
85- const staticData1 = "0x" + "03" + "01" + "00000001" + "00000000" + "0205030101" ;
86+ const staticData1 = "0x" + "03" + "01" + "00000001" + "00000000" + "00000000" + " 0205030101";
8687 // body=12,eye=5,mouth=3,equip=0,flower=0 -> uint40 = 0x0003050c00
87- const staticData2 = "0x" + "05" + "01" + "00000001" + "00000000" + "0003050c00" ;
88+ const staticData2 = "0x" + "05" + "01" + "00000001" + "00000000" + "00000000" + " 0003050c00";
8889 const logs = [
8990 makeLog ( "Store_SetRecord" , TARUCHI_STATUS_TABLE_ID , staticData1 ) ,
9091 makeLog ( "Store_SetRecord" , TARUCHI_STATUS_TABLE_ID , staticData2 ) ,
0 commit comments