github.com/status-im/status-go@v1.1.0/services/connector/commands/client_handler_test.go (about) 1 package commands 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestClientHandlerTimeout(t *testing.T) { 11 clientHandler := NewClientSideHandler() 12 13 backupWalletResponseMaxInterval := WalletResponseMaxInterval 14 WalletResponseMaxInterval = 1 * time.Millisecond 15 16 _, _, err := clientHandler.RequestShareAccountForDApp(testDAppData) 17 assert.Equal(t, ErrWalletResponseTimeout, err) 18 WalletResponseMaxInterval = backupWalletResponseMaxInterval 19 } 20 21 func TestRequestRejectedWhileWaiting(t *testing.T) { 22 clientHandler := NewClientSideHandler() 23 24 clientHandler.setRequestRunning() 25 26 _, _, err := clientHandler.RequestShareAccountForDApp(testDAppData) 27 assert.Equal(t, ErrAnotherConnectorOperationIsAwaitingFor, err) 28 }