Skip to content

FC#1

Open
st1zz1y wants to merge 1 commit intomasterfrom
SI
Open

FC#1
st1zz1y wants to merge 1 commit intomasterfrom
SI

Conversation

@st1zz1y
Copy link
Copy Markdown
Owner

@st1zz1y st1zz1y commented Mar 27, 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

Comment thread parcel.go
return err
}

rowsAffected, err := res.RowsAffected()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

это ок - не ошибка

но нужно тогда main было поправить - иначе до конца не выполнится

Comment thread parcel_test.go
// проверьте, что значения всех полей в полученном объекте совпадают со значениями полей в переменной parcel
p, err := store.Get(id)
require.NoError(t, err)
require.Equal(t, id, p.Number)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assert

Comment thread parcel_test.go
// добавьте новую посылку в БД, убедитесь в отсутствии ошибки и наличии идентификатора
id, err := store.Add(parcel)
require.NoError(t, err)
require.True(t, id > 0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

есть в testify для этого функция

Comment thread parcel_test.go
for _, p := range storedParcels {
expected, ok := parcelMap[p.Number]
require.True(t, ok)
require.Equal(t, expected.Client, p.Client)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assert.Equal(t, expected, p)

Comment thread parcel_test.go

for _, p := range storedParcels {
expected, ok := parcelMap[p.Number]
require.True(t, ok)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assert

Comment thread parcel_test.go
// убедитесь, что значения полей полученных посылок заполнены верно
storedParcels, err := store.GetByClient(client)
require.NoError(t, err)
require.Equal(t, len(parcels), len(storedParcels))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assert.Len

Comment thread parcel_test.go
// получите добавленную посылку и убедитесь, что статус обновился
p, err := store.Get(id)
require.NoError(t, err)
require.Equal(t, ParcelStatusSent, p.Status)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assert

Comment thread parcel_test.go
// получите добавленную посылку и убедитесь, что адрес обновился
p, err := store.Get(id)
require.NoError(t, err)
require.Equal(t, newAddress, p.Address)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assert

Comment thread parcel_test.go
require.NoError(t, err)

_, err = store.Get(id)
require.ErrorIs(t, err, sql.ErrNoRows)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

лучше так
require.Error
assert.ErrorIs

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