-
Notifications
You must be signed in to change notification settings - Fork 10
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
ARCO-202: Adding unit test for callerback sender #630
base: main
Are you sure you want to change the base?
Conversation
internal/callbacker/sender_test.go
Outdated
})) | ||
defer server.Close() | ||
logger := slog.New(slog.NewTextHandler(new(bytes.Buffer), nil)) | ||
sender, err := callbacker.NewSender(server.Client(), logger) |
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.
Rename sender
to sut
responseStatus: http.StatusOK, | ||
expectedSuccess: true, | ||
expectedRetries: 1, | ||
}, |
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.
Add another case where responseStatus
is an error e.g. http.StatusInternalServerError
internal/callbacker/sender_test.go
Outdated
func TestCallbackSender_GracefulStop(t *testing.T) { | ||
// Given | ||
logger := slog.New(slog.NewTextHandler(new(bytes.Buffer), nil)) | ||
sender, err := callbacker.NewSender(http.DefaultClient, logger) |
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.
Rename sender
to sut
internal/callbacker/sender_test.go
Outdated
func TestCallbackSender_Health(t *testing.T) { | ||
// Given | ||
logger := slog.New(slog.NewTextHandler(new(bytes.Buffer), nil)) | ||
sender, err := callbacker.NewSender(http.DefaultClient, logger) |
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.
Rename sender
to sut
internal/callbacker/sender_test.go
Outdated
// Given | ||
client := &http.Client{} | ||
logger := slog.New(slog.NewJSONHandler(bytes.NewBuffer([]byte{}), nil)) | ||
sender, _ := callbacker.NewSender(client, logger) |
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.
Rename sender
to sut
internal/callbacker/sender_test.go
Outdated
defer server.Close() | ||
|
||
logger := slog.New(slog.NewTextHandler(new(bytes.Buffer), nil)) | ||
sender, err := callbacker.NewSender(server.Client(), logger) |
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.
Rename sender
to sut
dtos: []*callbacker.Callback{{TxID: "1234", TxStatus: "SEEN_ON_NETWORK"}, {TxID: "5678", TxStatus: "MINED"}}, | ||
responseStatus: http.StatusOK, | ||
expectedSuccess: true, | ||
}, |
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.
Add another case where responseStatus
is an error e.g. http.StatusInternalServerError
Quality Gate passedIssues Measures |
Description of Changes
Adding unit test for callerback sender