add mock state to failing tests

This commit is contained in:
Carlosokumu 2025-02-04 10:16:12 +03:00
parent 815e3b2a25
commit f7873bfef7
Signed by: carlos
GPG Key ID: 7BD6BC8160A5C953

View File

@ -1857,12 +1857,14 @@ func TestVerifyNewPin(t *testing.T) {
sessionId := "session123" sessionId := "session123"
fm, _ := NewFlagManager(flagsPath) fm, _ := NewFlagManager(flagsPath)
mockState := state.NewState(16)
flag_valid_pin, _ := fm.GetFlag("flag_valid_pin") flag_valid_pin, _ := fm.GetFlag("flag_valid_pin")
mockAccountService := new(mocks.MockAccountService) mockAccountService := new(mocks.MockAccountService)
h := &MenuHandlers{ h := &MenuHandlers{
flagManager: fm, flagManager: fm,
accountService: mockAccountService, accountService: mockAccountService,
st: mockState,
} }
ctx := context.WithValue(context.Background(), "SessionId", sessionId) ctx := context.WithValue(context.Background(), "SessionId", sessionId)
@ -1900,6 +1902,7 @@ func TestVerifyNewPin(t *testing.T) {
func TestConfirmPin(t *testing.T) { func TestConfirmPin(t *testing.T) {
sessionId := "session123" sessionId := "session123"
mockState := state.NewState(16)
ctx, store := InitializeTestStore(t) ctx, store := InitializeTestStore(t)
ctx = context.WithValue(ctx, "SessionId", sessionId) ctx = context.WithValue(ctx, "SessionId", sessionId)
@ -1910,6 +1913,7 @@ func TestConfirmPin(t *testing.T) {
userdataStore: store, userdataStore: store,
flagManager: fm, flagManager: fm,
accountService: mockAccountService, accountService: mockAccountService,
st: mockState,
} }
tests := []struct { tests := []struct {