Skip to content

Fb2#1

Open
st1zz1y wants to merge 5 commits intomainfrom
FB2
Open

Fb2#1
st1zz1y wants to merge 5 commits intomainfrom
FB2

Conversation

@st1zz1y
Copy link
Copy Markdown
Owner

@st1zz1y st1zz1y commented Mar 25, 2025

No description provided.

Copy link
Copy Markdown

@dirtymew dirtymew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Степан

PR оформлен как надо - отлично

по работе есть критичное замечания

тесты пишутся в файлах с суффиксом _test - те если код в precode.go то тесты в precode_test.go

команда go test ./... должна запускать все написанные тесты и они должны проходить успешно

Comment thread precode.go Outdated
func TestMainHandlerCorrectRequest(t *testing.T) {
req := httptest.NewRequest(http.MethodGet, "/cafe?city=moscow&count=2", nil)
rr := httptest.NewRecorder()
mainHandle(rr, req)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

неверно нужно запрос "послать" через сервер

примерно так:

responseRecorder := httptest.NewRecorder()
handler := http.HandlerFunc(mainHandle)
handler.ServeHTTP(responseRecorder, req)

Copy link
Copy Markdown

@dirtymew dirtymew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет Степан

кажется запутался с git

код не компилируется в ветке и тесты не запускаются

еще раз код сервера в одном файле например precode.go или main.go

тесты в другом

код должен быть компилируемым и тесты запускаться и проходить по команде go test ./...

Copy link
Copy Markdown

@dirtymew dirtymew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Степан

работу принимаю - но все еще остались замечания

Comment thread main_test.go
@@ -0,0 +1,44 @@
package main
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❯ go test ./...

./...

pattern ./...: directory prefix . does not contain main module or its selected dependencies
FAIL ./... [setup failed]
FAIL

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go mod init test
go mod tidy

❯ go test ./...   
ok      test    0.366s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants