package testutil import ( "context" "github.com/paramah/gw_telegram/internal/domain/apperror" "github.com/paramah/gw_telegram/internal/domain/entity" ) type FakeSessionStore struct { Sessions map[int64]entity.Session GetError error SetCalled bool LastSetSession entity.Session } func (f *FakeSessionStore) Get(_ context.Context, userID int64) (entity.Session, error) { if f.GetError != nil { return entity.Session{}, f.GetError } if f.Sessions != nil { if s, ok := f.Sessions[userID]; ok { return s, nil } } return entity.Session{}, apperror.ErrSessionNotFound } func (f *FakeSessionStore) Set(_ context.Context, session entity.Session) error { f.SetCalled = true f.LastSetSession = session if f.Sessions == nil { f.Sessions = make(map[int64]entity.Session) } f.Sessions[session.UserID] = session return nil } func (f *FakeSessionStore) Delete(_ context.Context, userID int64) error { if f.Sessions != nil { delete(f.Sessions, userID) } return nil }