@@ -218,16 +218,17 @@ func TestProc_Poll_WithGomock(t *testing.T) {
218218 defer proc .Close (ctx )
219219 defer runtime .Close (ctx )
220220
221- // Test that poll function exists
222- pollFunc := proc .Module .ExportedFunction ("poll " )
223- assert .NotNil (t , pollFunc , "poll function should exist" )
221+ // Test that echo function exists
222+ echoFunc := proc .Module .ExportedFunction ("echo " )
223+ assert .NotNil (t , echoFunc , "echo function should exist" )
224224
225225 // The echo WASM module will try to read from stdin, so we need to expect Read calls
226- // The poll function reads up to 512 bytes from stdin
226+ // The echo function reads up to 512 bytes from stdin
227227 mockStream .EXPECT ().Read (gomock .Any ()).Return (0 , io .EOF ).AnyTimes ()
228+ mockStream .EXPECT ().Reset ().Return (nil ).AnyTimes ()
228229
229- // Actually call the Poll method - this should succeed since we have a valid WASM function
230- err = proc .ProcessMessage (ctx , mockStream , "poll " )
230+ // Actually call the ProcessMessage method - this should succeed since we have a valid WASM function
231+ err = proc .ProcessMessage (ctx , mockStream , "echo " )
231232 // The WASM function should execute successfully
232233 assert .NoError (t , err )
233234 })
@@ -272,13 +273,14 @@ func TestProc_Poll_WithGomock(t *testing.T) {
272273 mockStream .EXPECT ().SetReadDeadline (deadline ).Return (nil )
273274 // The echo WASM module will try to read from stdin
274275 mockStream .EXPECT ().Read (gomock .Any ()).Return (0 , io .EOF ).AnyTimes ()
276+ mockStream .EXPECT ().Reset ().Return (nil ).AnyTimes ()
275277
276- // Test that poll function exists (for async mode)
277- pollFunc := proc .Module .ExportedFunction ("poll " )
278- assert .NotNil (t , pollFunc , "poll function should exist" )
278+ // Test that echo function exists (for async mode)
279+ echoFunc := proc .Module .ExportedFunction ("echo " )
280+ assert .NotNil (t , echoFunc , "echo function should exist" )
279281
280282 // Actually call the ProcessMessage method to trigger the mock expectations
281- err = proc .ProcessMessage (ctxWithDeadline , mockStream , "poll " )
283+ err = proc .ProcessMessage (ctxWithDeadline , mockStream , "echo " )
282284 // The WASM function should execute successfully
283285 assert .NoError (t , err )
284286 })
@@ -303,7 +305,7 @@ func TestProc_Poll_WithGomock(t *testing.T) {
303305 deadlineErr := errors .New ("deadline error" )
304306 mockStream .EXPECT ().SetReadDeadline (deadline ).Return (deadlineErr )
305307
306- err := proc .ProcessMessage (ctxWithDeadline , mockStream , "poll " )
308+ err := proc .ProcessMessage (ctxWithDeadline , mockStream , "echo " )
307309 assert .Error (t , err )
308310 assert .Contains (t , err .Error (), "set read deadline" )
309311 assert .Contains (t , err .Error (), "deadline error" )
@@ -547,9 +549,9 @@ func TestProc_Integration_WithRealWasm(t *testing.T) {
547549 assert .NotEmpty (t , proc .Endpoint .Name , "Endpoint should have a name" )
548550 assert .NotEmpty (t , proc .ID (), "String should not be empty" )
549551
550- // Test that the poll function is exported
551- pollFunc := proc .Module .ExportedFunction ("poll " )
552- assert .NotNil (t , pollFunc , "poll function should be exported" )
552+ // Test that the echo function is exported
553+ echoFunc := proc .Module .ExportedFunction ("echo " )
554+ assert .NotNil (t , echoFunc , "echo function should be exported" )
553555}
554556
555557// TestEcho_Synchronous tests the echo example in synchronous mode
@@ -689,9 +691,14 @@ func TestEcho_Asynchronous(t *testing.T) {
689691 Return (nil ).
690692 AnyTimes ()
691693
694+ mockStream .EXPECT ().
695+ Reset ().
696+ Return (nil ).
697+ AnyTimes ()
698+
692699 // Process message with the mock stream
693700 // This should process one complete message (until EOF)
694- err = proc .ProcessMessage (ctx , mockStream , "poll " )
701+ err = proc .ProcessMessage (ctx , mockStream , "echo " )
695702 require .NoError (t , err , "ProcessMessage should succeed" )
696703
697704 // Verify the output matches the input
@@ -780,8 +787,13 @@ func TestEcho_RepeatedAsync(t *testing.T) {
780787 Return (nil ).
781788 AnyTimes ()
782789
790+ mockStream .EXPECT ().
791+ Reset ().
792+ Return (nil ).
793+ AnyTimes ()
794+
783795 // Process message with the mock stream
784- err = proc .ProcessMessage (ctx , mockStream , "poll " )
796+ err = proc .ProcessMessage (ctx , mockStream , "echo " )
785797 require .NoError (t , err , "ProcessMessage should succeed for message %d" , i + 1 )
786798
787799 // Verify the output matches the input
0 commit comments