Skip to content

Resolves issue #1682, Remove redundant authority fields from Mongoose discriminator schemas (CNAOrg, SecretariatOrg, RootOrg) and verify behavior using a new integration test suite.#1816

Merged
david-rocca merged 2 commits into
devfrom
dr_1682
May 21, 2026

Conversation

@david-rocca
Copy link
Copy Markdown
Collaborator

@david-rocca david-rocca commented May 20, 2026

Closes Issue #1682

Summary

This PR cleans up the Mongoose discriminator schemas (cnaorg.js, secretariatorg.js, and rootorg.js) by removing the redundant authority property. Because these models automatically inherit all schema properties from the parent BaseOrg schema, defining authority: [String] redundantly was unnecessary.

Note that the JSON AJV validation schemas under schemas/registry-org/ remain unchanged to continue enforcing strict payload validation (where authority is indeed required/validated during POST and PUT requests). A new integration test suite has been introduced to verify inheritance behavior, persistence correctness, and API payload compatibility.

Important Changes

src/model/cnaorg.js

  • Removed redundant authority: [String] schema property.

src/model/secretariatorg.js

  • Removed redundant authority: [String] schema property.

src/model/rootorg.js

  • Removed redundant authority: [String] schema property.

test/integration-tests/registry-org/registryOrgDiscriminatorAuthorityTest.js

  • Created a new integration test suite covering CNA, Secretariat, and Root org creation, querying, and deletion, ensuring the inherited authority is correctly stored in MongoDB and returned.

Testing

Steps to manually test updated functionality, if possible

  • 1) Run the integration tests using: bash -i -c "npm run test:integration" and verify all 402 tests pass.
  • 2) Run the unit tests using: bash -i -c "npm run test:unit-tests" and verify all 259 tests pass.

Notes

  • Used the /api/registryOrg/ DELETE endpoint in test hooks to properly clean up created test records from MongoDB.

@david-rocca david-rocca changed the title removed redundant stuff in models. Created unit tests to make sure th… Resolves issue #1682, Remove redundant authority fields from Mongoose discriminator schemas (CNAOrg, SecretariatOrg, RootOrg) and verify behavior using a new integration test suite. May 20, 2026
@david-rocca david-rocca merged commit 9ac3214 into dev May 21, 2026
8 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.

2 participants