Skip to content

Add unit tests for orgauth package#2

Draft
Copilot wants to merge 3 commits into0.0.1from
copilot/add-unit-tests
Draft

Add unit tests for orgauth package#2
Copilot wants to merge 3 commits into0.0.1from
copilot/add-unit-tests

Conversation

Copy link

Copilot AI commented Mar 4, 2026

  • Explore repository structure and understand the codebase
  • Create tests directory structure following R package conventions
  • Create tests/testthat.R setup file
  • Add unit tests for validate_email function (utils.R)
  • Add unit tests for validate_orcid function (utils.R)
  • Add unit tests for org_item R6 class
  • Add unit tests for org_list R6 class
  • Add unit tests for author2df function
  • Add unit tests for inbo_org_list function
  • Add unit tests for is_repository function
  • Add unit tests for menu_first function
  • Validate test file syntax (all files parse correctly)
  • Fix 8 failing unit tests (use unname() for named vector comparisons)
  • Fix linter warnings about long lines in test-validate_orcid.R
  • Run code review

Summary: Added 62 unit tests across 8 test files covering core functionality including validation functions, R6 classes (org_item, org_list), and utility functions. Tests follow testthat 3.0 conventions and are integrated with existing CI workflows.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: ThierryO <446636+ThierryO@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for existing code Add unit tests for orgauth package Mar 4, 2026
Copy link
Member

@ThierryO ThierryO left a comment

Choose a reason for hiding this comment

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

According to the check_package action there are at least 8 failing unit tests. Please find and fix them. Also fix the linter warnings about long lines.


test_that("inbo_org_list has correct git URL", {
ol <- inbo_org_list()
expect_equal(ol$get_git, "https://github.com/inbo")
Copy link
Member

Choose a reason for hiding this comment

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

This unit test failed according to the check package github action

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in baed793. The issue was that ol$get_git returns a named vector, so expect_equal was failing due to the names attribute mismatch. Added unname() to compare just the value.

Co-authored-by: ThierryO <446636+ThierryO@users.noreply.github.com>
Copy link
Author

Copilot AI commented Mar 4, 2026

According to the check_package action there are at least 8 failing unit tests. Please find and fix them. Also fix the linter warnings about long lines.

Fixed all 8 failing tests and 2 linter warnings in baed793:

  • Test failures: Fixed by using unname() when comparing named vectors with expected strings (affected test-org_item.R, test-org_list.R, and test-inbo_org_list.R)
  • Linter warnings: Removed trailing comments from lines 3 and 24 in test-validate_orcid.R to get them under 80 characters

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