@@ -5,6 +5,8 @@ local Lync = require(script.Parent.Parent.Parent)
55local Runner = require (script .Parent .Parent .Runner )
66local describe , it , expect = Runner .describe , Runner .it , Runner .expect
77
8+ local mockReg = Channel .mockReg
9+
810describe ("Channel.create" , function (): ()
911 it ("size 1024" , function (): ()
1012 expect (Channel .create ().size ):toBe (1024 )
5961describe ("Channel.writeBatch" , function (): ()
6062 it ("advances cursor" , function (): ()
6163 local ch = Channel .create ()
62- Channel .writeBatch (ch , 1 , "t" , Lync .u8 , 42 )
64+ Channel .writeBatch (ch , mockReg ( 1 , "t" , Lync .u8 ) , 42 )
6365 expect (ch .cursor ):toBeGreaterThan (0 )
6466 end )
6567 it ("same ID increments itemCount" , function (): ()
6668 local ch = Channel .create ()
67- Channel .writeBatch (ch , 1 , "a" , Lync .u8 , 10 )
68- Channel .writeBatch (ch , 1 , "a" , Lync .u8 , 20 )
69+ local reg = mockReg (1 , "a" , Lync .u8 )
70+ Channel .writeBatch (ch , reg , 10 )
71+ Channel .writeBatch (ch , reg , 20 )
6972 expect (ch .itemCount ):toBe (2 )
7073 end )
7174end )
@@ -78,7 +81,7 @@ describe("Channel.sealAndDump", function(): ()
7881 end )
7982 it ("non-empty is positive length" , function (): ()
8083 local ch = Channel .create ()
81- Channel .writeBatch (ch , 1 , "t" , Lync .u8 , 255 )
84+ Channel .writeBatch (ch , mockReg ( 1 , "t" , Lync .u8 ) , 255 )
8285 local raw , _ = Channel .sealAndDump (ch )
8386 expect (buffer.len (raw )):toBeGreaterThan (0 )
8487 end )
115118describe ("Channel.reset" , function (): ()
116119 it ("zeroes all state" , function (): ()
117120 local ch = Channel .create ()
118- Channel .writeBatch (ch , 1 , "t" , Lync .u8 , 1 )
121+ Channel .writeBatch (ch , mockReg ( 1 , "t" , Lync .u8 ) , 1 )
119122 table.insert (ch .refs , Instance .new ("Part" ))
120123 Channel .reset (ch )
121124 expect (ch .cursor ):toBe (0 )
0 commit comments