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

[TestGru] Add unit test for src/utils/point_in_time.ts #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gru-agent[bot]
Copy link

@gru-agent gru-agent bot commented Jan 20, 2025

Trigger Info

Trigger Type Triggered By Source File Assignment
Manual zthreefires src/utils/point_in_time.ts Detail

Summary

This PR introduces unit tests for the parsePITBranch and parsePointInTime utility functions, ensuring proper validation and behavior for parsing point-in-time (PIT) branches and resolving PIT references. Key highlights include:

  • parsePITBranch Tests:

    • Validates parsing of branches without PIT (e.g., main).

    • Tests parsing of branches with LSN (e.g., main@0/0).

    • Validates branches with timestamps, including checks for invalid or future timestamps.

    • Ensures appropriate errors are thrown for invalid formats.

  • parsePointInTime Tests:

    • Resolves special references like ^self and ^parent.

    • Handles cases where the parent branch is not found, throwing appropriate errors.

    • Validates custom branches with LSN, leveraging mocked branchIdResolve.

  • Mocks and Spies:

    • Mocked formats.looksLikeLSN and formats.looksLikeTimestamp for format validation.

    • Mocked getProjectBranch API call for resolving parent branches.

    • Mocked branchIdResolve for resolving custom branch IDs.

These tests ensure robust handling of PIT parsing logic and improve confidence in the utility's correctness.

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

Tip

You can @gru-agent rebase to rebase the PR.

Tip

You can @gru-agent redo to reset or rebase before redoing the PR.

Tip

To modify the test code yourself, click here Edit Test Code

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