Skip to content

fix(test): align clip name with asset filename in ClipGetInfo test#738

Merged
dsarno merged 1 commit intoCoplayDev:betafrom
dsarno:fix/animation-clip-test-name
Feb 12, 2026
Merged

fix(test): align clip name with asset filename in ClipGetInfo test#738
dsarno merged 1 commit intoCoplayDev:betafrom
dsarno:fix/animation-clip-test-name

Conversation

@dsarno
Copy link
Collaborator

@dsarno dsarno commented Feb 12, 2026

Unity renames AnimationClip objects to match the asset filename on import. The test was setting name="InfoClip" but saving to a path with a GUID suffix, causing the assertion to fail.

Pre-existing issue from #696 (animation feature PR).

Summary by Sourcery

Bug Fixes:

  • Fix ClipGetInfo_ReturnsClipData test by matching the AnimationClip name to the generated asset filename before asserting the returned name.

Summary by CodeRabbit

  • Tests
    • Updated animation test to use dynamically generated clip names instead of hard-coded values for improved test flexibility and consistency.

Unity renames AnimationClip objects to match the asset filename on
import. The test was setting name="InfoClip" but saving to a path
with a GUID suffix, causing a name mismatch assertion failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 12, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the ClipGetInfo test to use a dynamically generated clip name that matches the imported asset filename, ensuring the test reflects Unity’s actual AnimationClip renaming behavior and fixes a failing name assertion.

File-Level Changes

Change Details Files
Align test clip name and asset filename to match Unity’s import-time renaming behavior in ClipGetInfo_ReturnsClipData.
  • Introduce a clipName variable that includes the GUID suffix used in the file path.
  • Update the clipPath construction to use clipName, ensuring filename and clip name are consistent.
  • Initialize the AnimationClip using clipName instead of a hardcoded name.
  • Adjust the final name assertion to compare against clipName rather than a fixed string.
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageAnimationTests.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@dsarno dsarno merged commit 5908d34 into CoplayDev:beta Feb 12, 2026
1 of 2 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The ClipGetInfo_ReturnsClipData test in ManageAnimationTests.cs is refactored to use dynamically generated clip names and file paths instead of hard-coded values, making the test more flexible while maintaining the same assertion logic.

Changes

Cohort / File(s) Summary
Test Refactoring
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Tools/ManageAnimationTests.cs
Replaced hard-coded "InfoClip" string with generated clipName variable and corresponding clipPath. Updated AnimationClip instantiation and assertion to use the dynamic variable instead of static value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A test that once stood firm and bound,
Now dances free with names unbound!
Variables spring where hardcodes were,
More flexible tests, both quick and sure! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dsarno dsarno deleted the fix/animation-clip-test-name branch February 13, 2026 04:28
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