Skip to content

Commit

Permalink
refactor: combine const
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzFelix committed Sep 24, 2023
1 parent d3a2502 commit dedaca4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions wbmalert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import (
"testing"
)

const HTTP_GET_BODY = "<p>Test</p>"
const WANT = "Test"
const (
HTTP_GET_BODY = "<p>Test</p>"
WANT = "Test"
)

type MockClient struct {
type mockClient struct {
DoFunc func(req *http.Request) (*http.Response, error)
}

func (m *MockClient) Do(req *http.Request) (*http.Response, error) {
func (m *mockClient) Do(req *http.Request) (*http.Response, error) {
reader := strings.NewReader(HTTP_GET_BODY)
readCloser := io.NopCloser(reader)
response := http.Response{
Expand All @@ -24,7 +26,7 @@ func (m *MockClient) Do(req *http.Request) (*http.Response, error) {
}

func TestGetWebsiteAsString(t *testing.T) {
client = &MockClient{}
client = &mockClient{}
website := website{
Name: "Test",
Url: "https://google.com",
Expand Down

0 comments on commit dedaca4

Please sign in to comment.