Skip to content

Adding unit test from co-pilot (worked surprisingly well)#86

Merged
smasongarrison merged 11 commits intomainfrom
dev
Nov 4, 2025
Merged

Adding unit test from co-pilot (worked surprisingly well)#86
smasongarrison merged 11 commits intomainfrom
dev

Conversation

@smasongarrison
Copy link
Copy Markdown
Member

This pull request introduces comprehensive test coverage for the buildSpouseSegments function, clarifies documentation, and updates the package version to reflect ongoing development. The main focus is on ensuring the correctness and robustness of spouse segment construction logic under various scenarios.

Testing improvements:

  • Added extensive unit tests for the buildSpouseSegments function in tests/testthat/test-calcConnections.R, covering both use_hash=TRUE and use_hash=FALSE modes, edge cases (missing or unmatched IDs), and validation of output structure and cleanup of intermediate columns.

Documentation updates:

  • Clarified the description of the connections_for_FOO parameter in the documentation for both the function (R/calcConnections.R) and its manual page (man/buildSpouseSegments.Rd), specifying that it contains connections for spouse segments from parent connections. [1] [2]

Package maintenance:

  • Updated the package version in DESCRIPTION to 0.9.1.9000 to indicate a development build.
  • Added a corresponding entry in NEWS.md to document the new test coverage for buildSpouseSegments.
  • Minor cleanup in NEWS.md for clarity, removing redundant lines.

smasongarrison and others added 11 commits September 12, 2025 17:58
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
…rage-build-spouse-segments

Add test coverage for buildSpouseSegments in calcConnections.R
Added comprehensive test coverage for buildSpouseSegments, including cases for use_hash and spouseID logic, NA handling, and intermediate column removal. Updated documentation in R and Rd files to clarify the connections_for_FOO parameter. NEWS.md updated to reflect new test coverage.
@smasongarrison smasongarrison linked an issue Nov 4, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

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 comprehensive test coverage for the buildSpouseSegments function. The changes include:

  • Added 13 new test cases covering both use_hash=TRUE and use_hash=FALSE modes
  • Updated documentation to clarify that connections_for_FOO contains connections from parent connections
  • Updated version number to development version (0.9.1.9000)
  • Added NEWS entry documenting the test coverage addition

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/testthat/test-calcConnections.R Added 13 comprehensive test cases for buildSpouseSegments function covering both hash-based and spouse-based segment building
man/buildSpouseSegments.Rd Enhanced parameter documentation for connections_for_FOO
R/calcConnections.R Enhanced parameter documentation for connections_for_FOO
NEWS.md Added entry for test coverage addition and removed misplaced comment
DESCRIPTION Bumped version to development version 0.9.1.9000
Comments suppressed due to low confidence (2)

tests/testthat/test-calcConnections.R:1

  • Trailing backslash at the end of comment should be removed.
test_that("calculateConnections returns expected columns and structure", {

NEWS.md:8

  • Removed a standalone '## cran release' comment. Ensure this removal is intentional and doesn't affect the structure or meaning of the changelog for version 0.8.0.
## cran release

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@smasongarrison smasongarrison merged commit 2f5fcac into main Nov 4, 2025
17 checks passed
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.

Improve test coverage of buildSpouseSegments

3 participants