Skip to content

Add tests for Animate and RiverStoryScroll components #1123

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

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

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Jul 29, 2025

Summary

Backfills tests for Animate and RiverStoryScroll components to bring coverage up to 100%.

Ref support has not been tested as neither RiverStoryScroll nor Animate support ref forwarding with forwardRef. Animate will support implicit ref forwarding when we update to React 19, however I don't foresee any issues in this case as we don't rely on a ref internally within the Animate component.

Supporting resources (related issues, external links, etc)

Contributor checklist

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Copy link

changeset-bot bot commented Jul 29, 2025

⚠️ No Changeset found

Latest commit: 86b480a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Jul 29, 2025

🟢 No design token changes found

@joshfarrant joshfarrant force-pushed the joshfarrant/test-coverage-1 branch from 8924872 to d93787b Compare July 29, 2025 15:40
Copy link
Contributor

github-actions bot commented Jul 29, 2025

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@joshfarrant joshfarrant force-pushed the joshfarrant/test-coverage-1 branch from f79ea5f to d20002d Compare July 29, 2025 15:58
@joshfarrant joshfarrant marked this pull request as ready for review July 29, 2025 16:20
@joshfarrant joshfarrant requested review from Copilot and rezrah July 29, 2025 16:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive test coverage for the Animate and RiverStoryScroll components to achieve 100% test coverage. The tests cover component rendering, accessibility, animation behavior, responsive design, and edge cases.

Key changes:

  • Added 417 lines of tests for RiverStoryScroll component covering scroll interactions, responsive behavior, and error handling
  • Added 184 lines of tests for Animate component covering animation properties, element rendering, and prop handling
  • Implemented comprehensive mocking for browser APIs and animation hooks

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/react/src/river/RiverStoryScroll/RiverStoryScroll.test.tsx Complete test suite for RiverStoryScroll with intersection observer mocking, responsive tests, and edge case coverage
packages/react/src/animation/Animate/Animate.test.tsx Complete test suite for Animate component covering rendering, animation properties, and prop forwarding
Comments suppressed due to low confidence (1)

packages/react/src/animation/Animate/Animate.test.tsx:64

  • This test assumes that invalid 'as' props fall back to 'div', but without seeing the implementation, this behavior may not be guaranteed. The test should verify the actual fallback behavior implemented in the component rather than assuming it.
  it('falls back to div when invalid as prop is provided', () => {
    // @ts-expect-error Testing invalid prop
    const {container} = render(<Animate as="invalid">Content</Animate>)

    expect(container.firstChild?.nodeName).toBe('DIV')
  })

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