feat: Implement Jest and React Testing Library for component testing … #277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Add Testing Infrastructure and Contribution Guidelines
Related Tickets & Documents
Fixes: #[issue-number]
Description
This PR establishes a robust testing infrastructure and contribution workflow for the Keploy Blog Website. It lays the foundation for future contributors to write and run tests, ensuring code quality and reducing regressions.
Motivation
Changes
Documentation
CONTRIBUTING.mdREADME.md.github/PULL_REQUEST_TEMPLATE.mdTesting Infrastructure
jest.config.jsjest.setup.jsexpectwith@testing-library/jest-dommatchers..env.testutils/test-utils.tsx__tests__/smoke.test.js__tests__/post-card.test.tsxPostCardcomponent, covering:- Correct URL generation for Technology vs Community posts.
- Fallback to "Anonymous" when author is missing.
- Rendering of title and excerpt.
Configuration
tsconfig.json"types": ["jest", "node"]for proper TypeScript support in test files.package.json"test": "jest"script and dev dependencies:jest,jest-environment-jsdom,@testing-library/react,@testing-library/jest-dom,@testing-library/dom.Type of Change
Testing
npm testand all tests passed.Test Scenarios
Demo
N/A - This is a tooling/infrastructure PR. No UI changes.
Environment and Dependencies
jest(^30.2.0)jest-environment-jsdom(^30.2.0)@testing-library/react(^16.3.1)@testing-library/jest-dom(^6.9.1)@testing-library/dom(^10.4.1)@next/swc-win32-x64-msvc(platform-specific, installed to resolve SWC binary issue)tsconfig.jsonupdated to include Jest types..env.testfile added (should be in.gitignoreif it contains secrets, but currently only has the public WordPress API URL).Checklist
Signed-off-by: Suvam Paul suvampersonal555@gmail.com