Skip to content
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

Review tests, add additional documentation to emphasize intentions #94

Open
atc0005 opened this issue Mar 31, 2021 · 0 comments
Open

Review tests, add additional documentation to emphasize intentions #94

atc0005 opened this issue Mar 31, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation tests
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Mar 31, 2021

Currently I find the tests to be both to be brittle and not as clear as they could be. This is probably from a lack of an "ah ha!" moment.

I've made attempts to refactor with recent releases, but further work is needed to document exactly what is happening and why.

For example, one thing I spent an embarrassing amount of time on this AM was "remembering" the relationship between resError and error in the table test entries:

var tests = []struct {
reqURL string
reqMsg MessageCard
resStatus int // httpClient response status
resBody string // httpClient response body text
resError error // httpClient error
error error // method error
skipURLVal bool // whether webhook URL validation is applied (e.g., GH-68)
}{

If I recall correctly, you're specifying what client error is expected (e.g., connectivity issue) and what error is expected from invoking library functions/methods using provided table test data.

This table test entry is an example of where there is no client error, but there is an error returned from validating the target endpoint or request URL:

// invalid webhookURL - missing prefix in webhook URL
{
reqURL: "",
reqMsg: simpleMsgCard,
resStatus: 0,
resBody: "invalid",
resError: nil,
error: ErrWebhookURLUnexpectedPrefix,
skipURLVal: false,
},

@atc0005 atc0005 added documentation Improvements or additions to documentation tests labels Mar 31, 2021
@atc0005 atc0005 added this to the Future milestone Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation tests
Projects
None yet
Development

No branches or pull requests

1 participant