Skip to content

feat: add maxPopulateDepth configuration with getter/setter#27

Merged
matiaslopezd merged 3 commits into
mainfrom
develop
Sep 24, 2025
Merged

feat: add maxPopulateDepth configuration with getter/setter#27
matiaslopezd merged 3 commits into
mainfrom
develop

Conversation

@matiaslopezd

Copy link
Copy Markdown
Member

This pull request introduces a new configuration option to control the depth of population for referenced documents in the MongooseDummy class. The main change is the addition of a maxPopulateDepth property, which allows users to specify how many levels deep referenced documents should be populated when generating dummy data. Comprehensive tests have been added to verify the correct behavior for various depth settings.

Configuration and API changes

  • Added a maxPopulateDepth property to the MongooseDummy class, with a default value of 1. This property is accessible via getter/setter and can be set through the setup method. (src/index.js, [1] [2]
  • Updated the population logic in evaluateDummy and evaluateObjectId methods to respect the maxPopulateDepth setting, ensuring referenced documents are only populated up to the specified depth. (src/index.js, [1] [2]

Testing

  • Added a suite of tests to verify the maxPopulateDepth behavior, including default depth, zero population, multi-level population, configuration via setup, usage of getter/setter, and handling of nested subdocuments. (test/unit.test.js, test/unit.test.jsR205-R307)

@matiaslopezd matiaslopezd self-assigned this Sep 24, 2025
@matiaslopezd matiaslopezd added bug Something isn't working enhancement: feature New feature or request labels Sep 24, 2025
@matiaslopezd matiaslopezd changed the title feat: add maxPopulateDepth configuration with getter/setter and tests feat: add maxPopulateDepth configuration with getter/setter Sep 24, 2025
@matiaslopezd matiaslopezd merged commit 377e8e7 into main Sep 24, 2025
7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement: feature New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant