Skip to content

Conversation

@AronPerez
Copy link
Contributor

@AronPerez AronPerez commented Jul 21, 2025

Ticket

Description

Tests for #1523

How Has This Been Tested?

Unit Tests - Created repository_types.test.js covering:

  • Type creation and validation
  • Factory pattern functionality
  • Operation implementations
  • Error handling scenarios

Artifacts

See CI

Summary by Sourcery

Add a comprehensive test suite for the repository type system in the Foxx service to validate type definitions, input validation, factory functions, operations, and implementations, including integration workflows and legacy compatibility.

Tests:

  • Add unit tests for repository type enums, result constructs, and data creation utilities
  • Add unit tests for validation logic covering non-empty strings, POSIX paths, repository paths, and config rules
  • Add unit tests for the factory module, operations module, and type-specific implementations for Globus and metadata repositories
  • Add integration tests for end-to-end repository creation, persistence, allocation workflows and legacy Repo class compatibility

@AronPerez AronPerez added Component: Core Relates to core service Type: Test Related to unit or integration testing labels Jul 21, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 21, 2025

Reviewer's Guide

This PR introduces a comprehensive Mocha/Chai test suite (repository_types.test.js) that verifies core repository functionality—from basic type enums and validation routines through factory dispatch, CRUD operations, Globus/Metadata implementations, to full integration workflows and legacy compatibility—using ArangoDB collection cleanup for isolation.

File-Level Changes

Change Details Files
Add types and utility function tests
  • Verify RepositoryType and ExecutionMethod enums (values and immutability)
  • Test Result.ok/err behaviors
  • Validate createRepositoryData, createGlobusConfig, createRepository, createAllocationResult
core/database/foxx/tests/repository_types.test.js
Cover validation module functions
  • Test validateNonEmptyString and validateCommonFields error and success cases
  • Verify path validations (POSIX and repository path)
  • Ensure validateGlobusConfig, validateMetadataConfig, validateAllocationParams handle valid and invalid inputs
core/database/foxx/tests/repository_types.test.js
Test factory module behavior
  • Exercise createRepositoryByType for each repo type and error paths
  • Verify getRepositoryImplementation returns correct or null implementations
  • Validate executeRepositoryOperation dispatch and unknown-operation handling
core/database/foxx/tests/repository_types.test.js
Validate repository CRUD operations
  • Test RepositoryOps.find, list, save, update, validate, and checkPermission under various scenarios
  • Use beforeEach to reset ArangoDB collections for isolation
core/database/foxx/tests/repository_types.test.js
Add tests for Globus implementation
  • Ensure globusImpl.validate, supportsDataOperations, getCapacityInfo return expected results
  • Test createAllocation and deleteAllocation error handling
core/database/foxx/tests/repository_types.test.js
Add tests for Metadata implementation
  • Verify metadataImpl.validate and supportsDataOperations outcomes
  • Test getCapacityInfo, createAllocation, deleteAllocation direct behaviors
core/database/foxx/tests/repository_types.test.js
Implement integration and legacy compatibility tests
  • Full workflow: create, save, find, allocate for both repo types
  • Error propagation through createRepositoryByType
  • Validate different behaviors per type and backward compatibility with legacy Repo class
core/database/foxx/tests/repository_types.test.js

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@AronPerez AronPerez force-pushed the feat-DAPS-1513-rust-js-design branch from b0dde8d to 341115c Compare July 29, 2025 13:13
@AronPerez AronPerez force-pushed the feat-DAPS-1513-rust-js-design branch 2 times, most recently from ab78fa9 to ea59312 Compare August 13, 2025 14:57
@AronPerez AronPerez force-pushed the feat-DAPS-1513-rust-js-design branch 2 times, most recently from dc486e5 to 4b538dc Compare August 18, 2025 16:56
@AronPerez AronPerez force-pushed the feat-DAPS-1513-rust-js-design branch 3 times, most recently from 33c787f to 7c755f9 Compare August 28, 2025 18:11
@JoshuaSBrown JoshuaSBrown self-assigned this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Core Relates to core service Type: Test Related to unit or integration testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants