MCPcopy Create free account
hub / github.com/monitoror/monitoror / TestCount_Success

Function TestCount_Success

monitorables/github/api/usecase/github_test.go:37–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func 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
59func TestChecks_Error(t *testing.T) {
60 mockRepository := new(mocks.Repository)

Callers

nothing calls this directly

Calls 3

WithValueMethod · 0.80
NewGithubUsecaseFunction · 0.70
CountMethod · 0.65

Tested by

no test coverage detected