Skip to content

add some tests#186

Merged
theodore-s-beers merged 6 commits into
mainfrom
tsb_tests
May 26, 2026
Merged

add some tests#186
theodore-s-beers merged 6 commits into
mainfrom
tsb_tests

Conversation

@theodore-s-beers
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.Body after http.Post(...). This can leak connections and eventually stall future HTTP calls. Add a defer 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.

Comment thread client/auth.go
Comment thread checks/runner_test.go Outdated
@theodore-s-beers theodore-s-beers merged commit db43b71 into main May 26, 2026
@theodore-s-beers theodore-s-beers deleted the tsb_tests branch May 26, 2026 14:17
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