(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func TestCount_Error(t *testing.T) { |
| 21 | mockRepository := new(mocks.Repository) |
| 22 | mockRepository.On("GetCount", AnythingOfType("string")). |
| 23 | Return(0, errors.New("boom")) |
| 24 | |
| 25 | gu := NewGithubUsecase(mockRepository) |
| 26 | |
| 27 | tile, err := gu.Count(&models.CountParams{Query: "test"}) |
| 28 | if assert.Error(t, err) { |
| 29 | assert.Nil(t, tile) |
| 30 | assert.IsType(t, &coreModels.MonitororError{}, err) |
| 31 | assert.Equal(t, "unable to load count or wrong query", err.Error()) |
| 32 | mockRepository.AssertNumberOfCalls(t, "GetCount", 1) |
| 33 | mockRepository.AssertExpectations(t) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | func TestCount_Success(t *testing.T) { |
| 38 | mockRepository := new(mocks.Repository) |
nothing calls this directly
no test coverage detected