[client] Add unit tests for engine synchronization and Info flag copying

- Introduced tests for the Engine's handleSync method to verify behavior when SkipNetworkMapUpdate is true and when NetworkMap is nil.
- Added a test for the Info struct to ensure correct copying of flag values from one instance to another, while preserving unrelated fields.
This commit is contained in:
Hakan Sariman
2025-10-17 10:03:07 +03:00
parent fc141cf3a3
commit 20f5f00635
3 changed files with 168 additions and 4 deletions
+26
View File
@@ -0,0 +1,26 @@
package client
import (
"testing"
)
func TestGrpcClient_LastNetworkMapSerial_SetGet(t *testing.T) {
c := &GrpcClient{}
if got := c.getLastNetworkMapSerial(); got != 0 {
t.Fatalf("initial serial should be 0, got %d", got)
}
c.setLastNetworkMapSerial(123)
if got := c.getLastNetworkMapSerial(); got != 123 {
t.Fatalf("serial after set should be 123, got %d", got)
}
// overwrite should work
c.setLastNetworkMapSerial(5)
if got := c.getLastNetworkMapSerial(); got != 5 {
t.Fatalf("serial after overwrite should be 5, got %d", got)
}
}