Skip to content

Increase test coverage for priority files with lowest coverage - #118

Closed
jeffreyad with Copilot wants to merge 3 commits into
mainfrom
copilot/increase-test-coverage
Closed

Increase test coverage for priority files with lowest coverage#118
jeffreyad with Copilot wants to merge 3 commits into
mainfrom
copilot/increase-test-coverage

Conversation

Copilot AI commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Added 320 lines of tests targeting the 6 files with lowest coverage (51.52% - 86.84%), focusing on untested code paths, edge cases, and error handling.

Coverage improvements by file

  • R/sort.R (51.52%): Deprecated parameter warnings, empty dataframes, partial variable sets
  • R/supp.R (70.05%): Invalid input validation, column conflict detection, NA IDVAR handling
  • R/utils.R (75.00%): Invalid file paths, make_lone_dataset edge cases
  • R/labels.R (77.78%): Empty ellipsis, unlabeled data, variable mismatches
  • R/checks.R (85.44%): strict=FALSE behavior, numeric vs character NA handling
  • R/build.R (86.84%): Unknown data types, predecessor_only=TRUE, empty variable drops

Test patterns

All deprecated dataset_name parameters now have warning tests:

test_that("order_cols with deprecated dataset_name parameter", {
  expect_warning(
    order_cols(data, metacore, dataset_name = "ADSL"),
    "was deprecated in metatools 0.2.0"
  )
})

Edge cases for boundary conditions:

test_that("order_cols with empty data frame", {
  empty_data <- data[0, ]
  result <- order_cols(empty_data, spec)
  expect_equal(nrow(result), 0)
})

Error path validation:

test_that("combine_supp handles invalid inputs correctly", {
  expect_error(
    combine_supp("not a dataframe", safetyData::sdtm_suppae),
    "You must supply a domain and supplemental dataset"
  )
})
Original prompt

This section details on the original issue you should resolve

<issue_title>Increase Test Coverage</issue_title>
<issue_description>We should improve test coverage across the package, with priority on the files with the lowest coverage. This will help catch bugs earlier and make the codebase more maintainable.
Files needing attention

R/sort.R (51.52%) - Highest priority
R/supp.R (70.05%)
R/utils.R (75.00%)
R/labels.R (77.78%)
R/checks.R (85.44%)
R/build.R (86.84%)</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jeffreyad <112705781+jeffreyad@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test coverage across the package Increase test coverage for priority files with lowest coverage Dec 11, 2025
Copilot AI requested a review from jeffreyad December 11, 2025 20:22
@jeffreyad

Copy link
Copy Markdown
Collaborator

Closing this one

@jeffreyad jeffreyad closed this Dec 11, 2025
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.

Increase Test Coverage

2 participants