nodejs / nodejs.org

The Node.js® Website
https://nodejs.org
MIT License
6.15k stars 6.21k forks source link

Fix(test): TypeError in useBottomScrollListener Test Due to Incorrect act Import #6736

Closed TenzDelek closed 4 months ago

TenzDelek commented 4 months ago

Description

as mentioned in https://github.com/nodejs/nodejs.org/pull/6728#issuecomment-2122111441 We encountered an issue with the useBottomScrollListener tests where a TypeError is thrown, indicating that act is not a function. This error prevents the tests from running correctly.

Error Message The specific error message is:

image

This error occurs in the following test cases within hooks/react-client/tests/useBottomScrollListener.test.mjs: the cause of it was importing the act function from react instead of @testing-library/react. The act function from react is not compatible with the testing setup provided by React Testing Library, leading to the observed TypeError.

validation

Before:

image

after:

image

Check List

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview May 25, 2024 3:35pm
github-actions[bot] commented 4 months ago
Lighthouse Results URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 95 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 99 🟢 100 🟢 100 🟢 92 🔗
github-actions[bot] commented 4 months ago

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 92%
90.67% (593/654) 76.08% (175/230) 94.57% (122/129)

Unit Test Report

Tests Skipped Failures Errors Time
131 0 :zzz: 0 :x: 0 :fire: 6.439s :stopwatch: