@@ -33,6 +33,8 @@ func TestWSConfigGeneration(t *testing.T) {
33
33
utConf .Set (WSConfigKeyWriteBufferSize , 1024 )
34
34
utConf .Set (WSConfigKeyInitialConnectAttempts , 1 )
35
35
utConf .Set (WSConfigKeyPath , "/websocket" )
36
+ utConf .Set (WSConfigKeyBackgroundConnect , true )
37
+ utConf .Set (WSConfigKeyHeartbeatInterval , "42ms" )
36
38
37
39
ctx := context .Background ()
38
40
wsConfig , err := GenerateConfig (ctx , utConf )
@@ -48,6 +50,20 @@ func TestWSConfigGeneration(t *testing.T) {
48
50
assert .Equal (t , "custom value" , wsConfig .HTTPHeaders .GetString ("custom-header" ))
49
51
assert .Equal (t , 1024 , wsConfig .ReadBufferSize )
50
52
assert .Equal (t , 1024 , wsConfig .WriteBufferSize )
53
+ assert .True (t , wsConfig .BackgroundConnect )
54
+ assert .Equal (t , 42 * time .Millisecond , wsConfig .HeartbeatInterval )
55
+ }
56
+
57
+ func TestWSConfigGenerationDefaults (t * testing.T ) {
58
+ resetConf ()
59
+
60
+ ctx := context .Background ()
61
+ wsConfig , err := GenerateConfig (ctx , utConf )
62
+ assert .NoError (t , err )
63
+
64
+ assert .Equal (t , defaultInitialConnectAttempts , wsConfig .InitialConnectAttempts )
65
+ assert .False (t , wsConfig .BackgroundConnect )
66
+ assert .Equal (t , 30 * time .Second , wsConfig .HeartbeatInterval )
51
67
}
52
68
53
69
func TestWSConfigTLSGenerationFail (t * testing.T ) {
0 commit comments