(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestCount_Success(t *testing.T) { |
| 38 | mockRepository := new(mocks.Repository) |
| 39 | mockRepository.On("GetCount", AnythingOfType("string")). |
| 40 | Return(10, nil) |
| 41 | |
| 42 | gu := NewGithubUsecase(mockRepository) |
| 43 | |
| 44 | expected := coreModels.NewTile(api.GithubCountTileType).WithValue(coreModels.NumberUnit) |
| 45 | expected.Label = "GitHub count" |
| 46 | expected.Status = coreModels.SuccessStatus |
| 47 | expected.Value.Values = []string{"10"} |
| 48 | |
| 49 | tile, err := gu.Count(&models.CountParams{Query: "test"}) |
| 50 | if assert.NoError(t, err) { |
| 51 | assert.NotNil(t, tile) |
| 52 | assert.Equal(t, expected, tile) |
| 53 | |
| 54 | mockRepository.AssertNumberOfCalls(t, "GetCount", 1) |
| 55 | mockRepository.AssertExpectations(t) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestChecks_Error(t *testing.T) { |
| 60 | mockRepository := new(mocks.Repository) |
nothing calls this directly
no test coverage detected