Skip to content

Add unit tests for noiseDetail() - #9308

Merged
davepagurek merged 2 commits into
processing:mainfrom
harshiltewari2004:noise-detail-tests
Nov 14, 2026
Merged

davepagurek merged 2 commits into
processing:mainfrom
harshiltewari2004:noise-detail-tests

Conversation

@harshiltewari2004

Copy link
Copy Markdown
Contributor

Resolves #9253

Changes:

  • Adds a noiseDetail suite to test/unit/math/noise.js, using the existing private getters _getNoiseOctaves() / _getNoiseAmpFalloff():
    • defaults are 4 octaves and 0.5 falloff
    • sets octaves and falloff
    • ignores zero and negative values
    • resets falloff to 0.5 when it's omitted
    • changes the values returned by noise() (same seed, different detail)
  • An afterEach restores the defaults so state doesn't leak into other tests.
  • Removes the stale comment saying noiseSeed and noiseDetail need tests.

To check the tests can fail, I temporarily removed the falloff = 0.5 default in src/math/noise.js; the "resets falloff" test failed as expected (expected 0.25 to equal 0.5).

PR Checklist

  • npm run lint passes
  • [Inline reference] is included / updated — N/A, test-only change
  • [Unit tests] are included / updated

@harshiltewari2004

Copy link
Copy Markdown
Contributor Author

Hi @ksen0, whenever you have time: this one's ready for a look. The workflows are waiting for approval, so the required checks haven't run yet. Thanks!

@p5-bot

p5-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: 3b292ec

Previous deployments

a2cd33c


This is an automated message.

@davepagurek
davepagurek merged commit 470aa5a into processing:main Nov 14, 2026
4 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.

Add unit tests for noiseDetail()

2 participants