@@ -33,6 +33,8 @@ func TestWSConfigGeneration(t *testing.T) {
3333 utConf .Set (WSConfigKeyWriteBufferSize , 1024 )
3434 utConf .Set (WSConfigKeyInitialConnectAttempts , 1 )
3535 utConf .Set (WSConfigKeyPath , "/websocket" )
36+ utConf .Set (WSConfigKeyBackgroundConnect , true )
37+ utConf .Set (WSConfigKeyHeartbeatInterval , "42ms" )
3638
3739 ctx := context .Background ()
3840 wsConfig , err := GenerateConfig (ctx , utConf )
@@ -48,6 +50,20 @@ func TestWSConfigGeneration(t *testing.T) {
4850 assert .Equal (t , "custom value" , wsConfig .HTTPHeaders .GetString ("custom-header" ))
4951 assert .Equal (t , 1024 , wsConfig .ReadBufferSize )
5052 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 )
5167}
5268
5369func TestWSConfigTLSGenerationFail (t * testing.T ) {
0 commit comments