add some tests#186
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds unit tests for several checks helpers (TMDL extraction, jq evaluation, HTTP request handling, and submission result application) while also doing minor cleanup (Go-style variable naming) and documentation adjustments.
Changes:
- Added new Go tests under
checks/covering TMDL block extraction, jq parsing/querying, HTTP interpolation/request execution, and submission result messaging. - Renamed several Go locals from snake_case to camelCase for idiomatic Go style.
- Updated README command examples/placeholders for clarity.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Tweaks CLI troubleshooting/config examples and placeholders. |
| cmd/root.go | Renames auth-related locals to camelCase. |
| cmd/logout.go | Renames api_url local to apiURL. |
| cmd/login.go | Renames loginUrl local to loginURL. |
| client/lessons.go | Clarifies comment on HTTPRequestTest field usage. |
| client/auth.go | Renames api_url local to apiURL in auth helpers. |
| checks/tmdl.go | Improves doc comment for ExtractTmdlBlock. |
| checks/tmdl_test.go | Adds unit tests for ExtractTmdlBlock (including tab indentation). |
| checks/runner_test.go | Adds unit tests for ApplySubmissionResults message emission. |
| checks/jq.go | Uses fmt.Fprintf with strings.Builder for jq test descriptions. |
| checks/jq_test.go | Adds unit tests for jq input parsing, querying, formatting, and path extraction. |
| checks/http.go | Minor formatting of http.NewRequest call sites. |
| checks/http_test.go | Adds unit tests for interpolation, HTTP request execution, and body truncation. |
Comments suppressed due to low confidence (1)
client/auth.go:66
- LoginWithCode() never closes
resp.Bodyafterhttp.Post(...). This can leak connections and eventually stall future HTTP calls. Add adefer resp.Body.Close()immediately after confirming the request succeeded.
resp, err := http.Post(apiURL+"/v1/auth/otp/login", "application/json", bytes.NewReader(req))
if err != nil {
return nil, err
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fb1de6a to
2b60e03
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.