status-go/services/connector/commands/client_handler_test.go

29 lines
737 B
Go

package commands
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestClientHandlerTimeout(t *testing.T) {
clientHandler := NewClientSideHandler()
backupWalletResponseMaxInterval := WalletResponseMaxInterval
WalletResponseMaxInterval = 1 * time.Millisecond
_, _, err := clientHandler.RequestShareAccountForDApp(testDAppData)
assert.Equal(t, ErrWalletResponseTimeout, err)
WalletResponseMaxInterval = backupWalletResponseMaxInterval
}
func TestRequestRejectedWhileWaiting(t *testing.T) {
clientHandler := NewClientSideHandler()
clientHandler.setRequestRunning()
_, _, err := clientHandler.RequestShareAccountForDApp(testDAppData)
assert.Equal(t, ErrAnotherConnectorOperationIsAwaitingFor, err)
}