Skip to content

Conversation

@becoded
Copy link
Owner

@becoded becoded commented Oct 4, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 4, 2025 20:18
@codecov
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.00%. Comparing base (63cccc5) to head (e89bc04).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #104      +/-   ##
==========================================
+ Coverage   75.61%   76.00%   +0.38%     
==========================================
  Files          24       24              
  Lines        1542     1542              
==========================================
+ Hits         1166     1172       +6     
+ Misses        257      251       -6     
  Partials      119      119              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

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

Adds test coverage for String() methods of Role, RoleList, and Company domain types by introducing table-driven tests validating formatted output across varied field population scenarios.

  • Adds comprehensive String() representation tests for harvest.Role
  • Adds comprehensive String() representation tests for harvest.RoleList
  • Adds comprehensive String() representation tests for harvest.Company

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
harvest/role_test.go Adds table-driven tests for Role.String() and RoleList.String().
harvest/company_test.go Adds table-driven tests for Company.String().

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +411 to +418
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

got := tt.in.String()
assert.Equal(t, tt.want, got)
})
}
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

The loop variable tt is captured by the parallel subtest closure; in Go versions prior to 1.22 this can cause races/flaky tests because all goroutines may observe the final tt value. Safely shadow it with tt := tt inside the loop before t.Run.

Copilot uses AI. Check for mistakes.
Comment on lines +518 to +525
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

got := tt.in.String()
assert.Equal(t, tt.want, got)
})
}
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Same loop variable capture issue as above: add tt := tt inside the loop before invoking t.Run to avoid incorrect test data being used when run in parallel on Go versions prior to 1.22.

Copilot uses AI. Check for mistakes.
Comment on lines +161 to +168
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

got := tt.in.String()
assert.Equal(t, tt.want, got)
})
}
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

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

Loop variable tt is captured by a parallel subtest; add a shadow variable (tt := tt) inside the loop to prevent potential data races or mis-associations in parallel execution (required for safety on Go versions prior to 1.22).

Copilot uses AI. Check for mistakes.
@becoded becoded merged commit b5e3e76 into main Oct 4, 2025
11 checks passed
@becoded becoded deleted the unit-test branch October 4, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants