mirror of
https://github.com/status-im/status-go.git
synced 2025-01-30 16:38:21 +00:00
39 lines
1003 B
Go
39 lines
1003 B
Go
|
package requests
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
|
||
|
protocolRequests "github.com/status-im/status-go/protocol/requests"
|
||
|
"github.com/status-im/status-go/server/pairing"
|
||
|
)
|
||
|
|
||
|
func TestInputConnectionStringForBootstrapping_Validate(t *testing.T) {
|
||
|
t.Run("Valid input", func(t *testing.T) {
|
||
|
input := &InputConnectionStringForBootstrapping{
|
||
|
ConnectionString: "some-connection-string",
|
||
|
ReceiverClientConfig: &pairing.ReceiverClientConfig{
|
||
|
ReceiverConfig: &pairing.ReceiverConfig{
|
||
|
CreateAccount: &protocolRequests.CreateAccount{},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
err := input.Validate()
|
||
|
require.NoError(t, err)
|
||
|
})
|
||
|
|
||
|
t.Run("Missing ReceiverClientConfig", func(t *testing.T) {
|
||
|
input := &InputConnectionStringForBootstrapping{
|
||
|
ConnectionString: "some-connection-string",
|
||
|
ReceiverClientConfig: nil,
|
||
|
}
|
||
|
|
||
|
err := input.Validate()
|
||
|
require.Error(t, err)
|
||
|
require.Contains(t, err.Error(), "ReceiverClientConfig")
|
||
|
require.Contains(t, err.Error(), "required")
|
||
|
})
|
||
|
}
|