Skip to content

Chore: add missing tests for presets #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

chinmaypurav
Copy link
Contributor

This pull request expands the test coverage in PresetTest.php by adding snapshot tests for several additional CSP (Content Security Policy) presets. Each new preset now has an associated snapshot that verifies its CSP directives are stringified correctly. The main changes are the inclusion of new preset classes in the data provider and the addition of corresponding snapshot files with expected CSP outputs.

Test coverage expansion:

  • Added the following preset classes to the data provider in PresetTest.php, enabling snapshot testing for each: Algolia, Bootstrap, CloudflareCdn, GoogleLookerStudio, HeapAnalytics, JQuery, Maze, Sentry, VisualWebsiteOptimizer, and Whereby.

New snapshot files for CSP presets:

  • Added snapshot for Algolia preset, verifying connect-src for Algolia domains.
  • Added snapshot for Bootstrap preset, verifying style-src and font-src for MaxCDN.
  • Added snapshot for Cloudflare CDN preset, verifying style-src and script-src for Cloudflare CDN.
  • Added snapshot for Google Looker Studio preset, verifying frame-src for Looker Studio.
  • Added snapshot for Heap Analytics preset, verifying script-src, img-src, and connect-src for Heap Analytics.
  • Added snapshot for JQuery preset, verifying script-src for code.jquery.com.
  • Added snapshot for Maze preset, verifying script-src and connect-src for Maze domains.
  • Added snapshot for Sentry preset, verifying connect-src for Sentry ingest.
  • Added snapshot for Visual Website Optimizer preset, verifying script-src, img-src, and connect-src for Visual Website Optimizer.
  • Added snapshot for Whereby preset, verifying script-src and frame-src for Whereby domains.

These changes ensure that the CSP stringification logic is correctly validated for a broader set of third-party integrations.

@freekmurze freekmurze merged commit d4b6095 into spatie:main Aug 25, 2025
8 checks passed
@freekmurze
Copy link
Member

Thanks!

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