Skip to content
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

Fix Snapshot Tests for ICS Links #600

Merged

Conversation

BraedenKilburn
Copy link
Contributor

@BraedenKilburn BraedenKilburn commented Jul 25, 2024

Description:

This PR addresses the issues causing snapshot mismatches in the ics link generator tests. The following changes have been made to ensure the tests pass consistently:

  1. Fixed DTSTAMP Property:

    • Introduced a fixed system time for Jest tests using jest.setSystemTime and setting a constant date in a beforeAll block. This prevents the DTSTAMP property from changing with every test run.
  2. Stable UID Property:

    • Mocked Math.random to return a consistent value during tests. This ensures the UID property remains the same across test runs, resolving issues with snapshot testing.
  3. Consistent Line Endings:

    • Updated snapshots to use consistent line endings (%0D%0A for CRLF) in alignment with the changes made in PR #553. This ensures the generated ics links match the expected format in the snapshots.
  4. Included Missing PRODID Property:

    • Updated snapshots to include the newly added PRODID property, reflecting the latest structure of the ics links.

Changes Made:

  • Organized Tests with describe Blocks:
    • Wrapped each service test in a describe block for better organization and clarity. This helps in identifying which test failed and which service it relates to.

Testing:

  • Ran npm test to verify that all snapshot tests pass with the new configurations.
  • Confirmed that the snapshots match the expected output with fixed DTSTAMP, consistent UID, correct line endings, and included PRODID.

@BraedenKilburn
Copy link
Contributor Author

Fixes #599

@AnandChowdhary
Copy link
Owner

Thank you sir!

@AnandChowdhary AnandChowdhary merged commit 6da873c into AnandChowdhary:master Jul 31, 2024
3 checks passed
@FindingAnand
Copy link
Collaborator

🎉 This PR is included in version 2.6.1 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants