Resolved broken tests

This commit is contained in:
Samuel Hawksby-Robinson 2020-12-10 16:24:19 +00:00 committed by Andrea Maria Piana
parent 829108c96f
commit ca80140c1a
4 changed files with 20 additions and 8 deletions

View File

@ -63,7 +63,7 @@ func TestIdentityImage_MarshalJSON(t *testing.T) {
FileSize: 256,
ResizeTarget: 80,
}
expected := `{"key_uid":"","type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"file_size":256,"resize_target":80}`
expected := `{"keyUid":"","type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"fileSize":256,"resizeTarget":80}`
js, err := json.Marshal(ii)
require.NoError(t, err)

View File

@ -91,6 +91,7 @@ func (s *MessengerEmojiSuite) newMessenger(shh types.Waku) *Messenger {
func (s *MessengerEmojiSuite) TestSendEmoji() {
alice := s.m
alice.account = &multiaccounts.Account{KeyUID: "0xdeadbeef"}
key, err := crypto.GenerateKey()
s.Require().NoError(err)

View File

@ -11,6 +11,7 @@ import (
gomock "github.com/golang/mock/gomock"
account "github.com/status-im/status-go/account"
"github.com/status-im/status-go/account/generator"
types "github.com/status-im/status-go/eth-node/types"
)
@ -106,13 +107,14 @@ func (mr *MockAccountManagerMockRecorder) SelectAccount(arg0 interface{}) *gomoc
}
// CreateAccount mocks base method
func (m *MockAccountManager) CreateAccount(password string) (account.Info, string, error) {
func (m *MockAccountManager) CreateAccount(password string) (generator.GeneratedAccountInfo, account.Info, string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateAccount", password)
ret0, _ := ret[0].(account.Info)
ret1, _ := ret[1].(string)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
ret0, _ := ret[0].(generator.GeneratedAccountInfo)
ret1, _ := ret[1].(account.Info)
ret2, _ := ret[2].(string)
ret3, _ := ret[3].(error)
return ret0, ret1, ret2, ret3
}
// CreateAccount indicates an expected call of CreateAccount

View File

@ -4,6 +4,7 @@ import (
"context"
"crypto/ecdsa"
"errors"
"github.com/status-im/status-go/account/generator"
"testing"
"github.com/golang/mock/gomock"
@ -131,13 +132,17 @@ var signuptests = []struct {
},
expectedError: nil,
prepareExpectations: func(s *StatusSuite) {
mKInfo := generator.GeneratedAccountInfo{
IdentifiedAccountInfo: generator.IdentifiedAccountInfo{},
Mnemonic: "",
}
accountInfo := account.Info{
WalletAddress: "addr",
WalletPubKey: "pubkey",
ChatAddress: "addr",
ChatPubKey: "pubkey",
}
s.am.EXPECT().CreateAccount("password").Return(accountInfo, "mnemonic", nil)
s.am.EXPECT().CreateAccount("password").Return(mKInfo, accountInfo, "mnemonic", nil)
},
},
{
@ -149,7 +154,11 @@ var signuptests = []struct {
},
expectedError: errors.New("could not create the specified account : foo"),
prepareExpectations: func(s *StatusSuite) {
s.am.EXPECT().CreateAccount("password").Return(account.Info{}, "", errors.New("foo"))
mKInfo := generator.GeneratedAccountInfo{
IdentifiedAccountInfo: generator.IdentifiedAccountInfo{},
Mnemonic: "",
}
s.am.EXPECT().CreateAccount("password").Return(mKInfo, account.Info{}, "", errors.New("foo"))
},
},
}