(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestChecks_Error(t *testing.T) { |
| 60 | mockRepository := new(mocks.Repository) |
| 61 | mockRepository.On("GetChecks", AnythingOfType("string"), AnythingOfType("string"), AnythingOfType("string")). |
| 62 | Return(nil, errors.New("boom")) |
| 63 | |
| 64 | gu := NewGithubUsecase(mockRepository) |
| 65 | |
| 66 | tile, err := gu.Checks(&models.ChecksParams{Owner: "test", Repository: "test", Ref: "master"}) |
| 67 | if assert.Error(t, err) { |
| 68 | assert.Nil(t, tile) |
| 69 | assert.IsType(t, &coreModels.MonitororError{}, err) |
| 70 | assert.Equal(t, "unable to load ref checks", err.Error()) |
| 71 | mockRepository.AssertNumberOfCalls(t, "GetChecks", 1) |
| 72 | mockRepository.AssertExpectations(t) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestChecks_NoChecks(t *testing.T) { |
| 77 | mockRepository := new(mocks.Repository) |
nothing calls this directly
no test coverage detected