-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1 #1
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отличная работа, принято!
|
||
query := "UPDATE parcel SET address = ? WHERE number = ? AND status = ?" | ||
|
||
res, err := s.db.Exec(query, address, number, ParcelStatusRegistered) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Отлично!
} | ||
|
||
if rowsAffected == 0 { | ||
return fmt.Errorf("unable to change addres for parcel, incorrect status or parcel not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Оки, круто, что подумали про этот кейс
|
||
res, err := store.Get(id) | ||
require.NoError(t, err) | ||
assert.Equal(t, res.Client, parcel.Client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно в целом сделать следующим образом, чтобы не писать много кода и пвоерять каждое поле отдельно после того, как добавили посылку в БД и проверили, что нет ошибки
parcel.Number = id
assert.Equal(t, parcel, res)
No description provided.