Skip to content

Added unit tests to global.js functions.#1031

Merged
mauteri merged 1 commit intodevelopfrom
unit-tests
Mar 16, 2025
Merged

Added unit tests to global.js functions.#1031
mauteri merged 1 commit intodevelopfrom
unit-tests

Conversation

@mauteri
Copy link
Copy Markdown
Contributor

@mauteri mauteri commented Mar 16, 2025

Description of the Change

  • Added unit tests for global.js functions.

Closes #

How to test the Change

Changelog Entry

Added - New feature
Changed - Existing functionality
Deprecated - Soon-to-be removed feature
Removed - Feature
Fixed - Bug fix
Security - Vulnerability

Credits

Props @mauteri

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@what-the-diff
Copy link
Copy Markdown

what-the-diff bot commented Mar 16, 2025

PR Summary

  • Version Update in View Asset
    The version number in 'view.asset.php' has been updated. This is part of the general maintenance that ensures our application remains current with the latest version number.

  • Enhanced Pattern Handling in a Key Function
    The pattern recognition in our 'toCamelCase' function (found in 'globals.js') has been improved. Here we handle things like word spacing in our code. The function can now deal with instances where there are one or more underscores in a row.

  • Test Coverage Expansion
    Some additional 'unit tests' have been introduced in the 'globals.test.js' file to verify various functions. Unit tests serve as 'health checks' for individual parts of our project, allowing us to catch potential problems early. Newly covered functions include 'getFromGlobal', 'setToGlobal', 'toCamelCase', and 'safeHTML'.

  • Scenarios Covered in the new Test Suites
    The new tests take into account common real-world scenarios. These include fetching and setting values globally, and making sure HTML input is properly sanitized (cleaned of potentially harmful or disruptive content). This is a preventative measure against various mishaps relation to values handling and input sanitation.

@mauteri mauteri marked this pull request as ready for review March 16, 2025 18:40
@github-actions
Copy link
Copy Markdown
Contributor

Preview changes with Playground

You can preview the recent changes for PR#1031 with the following PHP versions:

PHP Version 8.3

PHP Version 7.4

Download .zip with build changes

Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions.

@mauteri mauteri merged commit f3f1018 into develop Mar 16, 2025
9 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.

1 participant