-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
#6: Integration Test Home Route #96
#6: Integration Test Home Route #96
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ce11319
to
af0e8ef
Compare
|
aabed4f
to
55717b6
Compare
Hi @shmbajaj, Big thanks from bottom of my heart for this wonderful efforts and timely updates and fast paced PR, This PR contains quite a few updates, can we arrange a call when we both and @chinmaykunkikar is free and review this PR and merge? p.s: It would be great if you could add snapshots of the test cases, so that i can get a overview... |
Firstly Thanks @krishnaacharyaa. Honestly I didn't understood what do you mean by |
I got it in the description :)
Sure |
b14ed49
to
83f9186
Compare
Closing PR because of wrong rebase conflicts created. |
@krishnaacharyaa closing this PR because of hells of commits created. |
Summary
Integration tests for HomePage route/component.
The tests are written from user POV, How user will behave and interact with home page.
NOTE:
To run tests local-backend is expected to be runningDescription
1. Renders Home Page:
HomePage
within aBrowserRouter
.2. Calls Mocked
useNavigate
Function:useNavigate
function.HomePage
and click the "Create post" button.mockedUseNavigate
function is called once.3. Renders Home Page with BlogFeed:
HomePage
, click a category pill, and check for related posts.4. Navigates on Featured Post Click:
HomePage
and click the first featured post card.mockedUseNavigate
function is called once.5. Renders Home Page with All Posts:
HomePage
.6. Navigates on All-Post Click:
HomePage
and click the first post card.mockedUseNavigate
function is called once.These tests cover various aspects of the
HomePage
component, including rendering, user interactions, and navigation behavior. The use of testing libraries facilitates thorough testing of the React application.Miscallenous FEYI
Cannot mock backend for testcases because using jest, vite and msw results into following errors, which can result into series of errors:
- Request/Response/TextEncoder is not defined (Jest)
- Cannot find module ‘msw/node’ (JSDOM)
- TS Error: Definitions of the following identifiers conflict with those in another file.
Issue(s) Addressed
#6
Images
Prerequisites