diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-11 18:31:20 +0200 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-11 18:31:20 +0200 |
| commit | 062b36fe5725d1267c66db2e506b4131d78ce772 (patch) | |
| tree | 998e5260feb1babac8dae512b56d67d8f20f7266 /api/api_service_mock_test.go | |
| parent | 7e4cf39a0ba6ccbd5cc036700a8b1ff9358ecc3d (diff) | |
simplify project structure
Diffstat (limited to 'api/api_service_mock_test.go')
| -rw-r--r-- | api/api_service_mock_test.go | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/api/api_service_mock_test.go b/api/api_service_mock_test.go deleted file mode 100644 index a7536be..0000000 --- a/api/api_service_mock_test.go +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package api - -import ( - "sync" -) - -// Ensure, that ServiceMock does implement Service. -// If this is not the case, regenerate this file with moq. -var _ Service = &ServiceMock{} - -// ServiceMock is a mock implementation of Service. -// -// func TestSomethingThatUsesService(t *testing.T) { -// -// // make and configure a mocked Service -// mockedService := &ServiceMock{ -// ScrapeURLFunc: func(url string, params map[string]any) (any, error) { -// panic("mock out the ScrapeURL method") -// }, -// } -// -// // use mockedService in code that requires Service -// // and then make assertions. -// -// } -type ServiceMock struct { - // ScrapeURLFunc mocks the ScrapeURL method. - ScrapeURLFunc func(url string, params map[string]any) (any, error) - - // calls tracks calls to the methods. - calls struct { - // ScrapeURL holds details about calls to the ScrapeURL method. - ScrapeURL []struct { - // URL is the url argument value. - URL string - // Params is the params argument value. - Params map[string]any - } - } - lockScrapeURL sync.RWMutex -} - -// ScrapeURL calls ScrapeURLFunc. -func (mock *ServiceMock) ScrapeURL(url string, params map[string]any) (any, error) { - if mock.ScrapeURLFunc == nil { - panic("ServiceMock.ScrapeURLFunc: method is nil but Service.ScrapeURL was just called") - } - callInfo := struct { - URL string - Params map[string]any - }{ - URL: url, - Params: params, - } - mock.lockScrapeURL.Lock() - mock.calls.ScrapeURL = append(mock.calls.ScrapeURL, callInfo) - mock.lockScrapeURL.Unlock() - return mock.ScrapeURLFunc(url, params) -} - -// ScrapeURLCalls gets all the calls that were made to ScrapeURL. -// Check the length with: -// -// len(mockedService.ScrapeURLCalls()) -func (mock *ServiceMock) ScrapeURLCalls() []struct { - URL string - Params map[string]any -} { - var calls []struct { - URL string - Params map[string]any - } - mock.lockScrapeURL.RLock() - calls = mock.calls.ScrapeURL - mock.lockScrapeURL.RUnlock() - return calls -} |