Documentation ¶
Index ¶
- type LoginInputs
- type Repository
- type RepositoryMock
- func (mock *RepositoryMock) CreateToken(ctx context.Context, token entities.Token) error
- func (mock *RepositoryMock) CreateTokenCalls() []struct{ ... }
- func (mock *RepositoryMock) GetToken(ctx context.Context, id string) (entities.Token, error)
- func (mock *RepositoryMock) GetTokenCalls() []struct{ ... }
- type UseCase
- type UseCaseMock
- func (mock *UseCaseMock) CreateToken(ctx context.Context, login LoginInputs) (string, error)
- func (mock *UseCaseMock) CreateTokenCalls() []struct{ ... }
- func (mock *UseCaseMock) ValidatesToken(ctx context.Context, tokenString string) (entities.Token, error)
- func (mock *UseCaseMock) ValidatesTokenCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type RepositoryMock ¶
type RepositoryMock struct { // CreateTokenFunc mocks the CreateToken method. CreateTokenFunc func(ctx context.Context, token entities.Token) error // GetTokenFunc mocks the GetToken method. GetTokenFunc func(ctx context.Context, id string) (entities.Token, error) // contains filtered or unexported fields }
RepositoryMock is a mock implementation of Repository.
func TestSomethingThatUsesRepository(t *testing.T) { // make and configure a mocked Repository mockedRepository := &RepositoryMock{ CreateTokenFunc: func(ctx context.Context, token entities.Token) error { panic("mock out the CreateToken method") }, GetTokenFunc: func(ctx context.Context, id string) (entities.Token, error) { panic("mock out the GetToken method") }, } // use mockedRepository in code that requires Repository // and then make assertions. }
func (*RepositoryMock) CreateToken ¶
CreateToken calls CreateTokenFunc.
func (*RepositoryMock) CreateTokenCalls ¶
func (mock *RepositoryMock) CreateTokenCalls() []struct { Ctx context.Context Token entities.Token }
CreateTokenCalls gets all the calls that were made to CreateToken. Check the length with:
len(mockedRepository.CreateTokenCalls())
func (*RepositoryMock) GetTokenCalls ¶
func (mock *RepositoryMock) GetTokenCalls() []struct { Ctx context.Context ID string }
GetTokenCalls gets all the calls that were made to GetToken. Check the length with:
len(mockedRepository.GetTokenCalls())
type UseCaseMock ¶
type UseCaseMock struct { // CreateTokenFunc mocks the CreateToken method. CreateTokenFunc func(ctx context.Context, login LoginInputs) (string, error) // ValidatesTokenFunc mocks the ValidatesToken method. ValidatesTokenFunc func(ctx context.Context, tokenString string) (entities.Token, error) // contains filtered or unexported fields }
UseCaseMock is a mock implementation of UseCase.
func TestSomethingThatUsesUseCase(t *testing.T) { // make and configure a mocked UseCase mockedUseCase := &UseCaseMock{ CreateTokenFunc: func(ctx context.Context, login LoginInputs) (string, error) { panic("mock out the CreateToken method") }, ValidatesTokenFunc: func(ctx context.Context, tokenString string) (entities.Token, error) { panic("mock out the ValidatesToken method") }, } // use mockedUseCase in code that requires UseCase // and then make assertions. }
func (*UseCaseMock) CreateToken ¶
func (mock *UseCaseMock) CreateToken(ctx context.Context, login LoginInputs) (string, error)
CreateToken calls CreateTokenFunc.
func (*UseCaseMock) CreateTokenCalls ¶
func (mock *UseCaseMock) CreateTokenCalls() []struct { Ctx context.Context Login LoginInputs }
CreateTokenCalls gets all the calls that were made to CreateToken. Check the length with:
len(mockedUseCase.CreateTokenCalls())
func (*UseCaseMock) ValidatesToken ¶
func (mock *UseCaseMock) ValidatesToken(ctx context.Context, tokenString string) (entities.Token, error)
ValidatesToken calls ValidatesTokenFunc.
func (*UseCaseMock) ValidatesTokenCalls ¶
func (mock *UseCaseMock) ValidatesTokenCalls() []struct { Ctx context.Context TokenString string }
ValidatesTokenCalls gets all the calls that were made to ValidatesToken. Check the length with:
len(mockedUseCase.ValidatesTokenCalls())
Click to show internal directories.
Click to hide internal directories.