Skip to content
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

[BUG][Feature] Write e2e, unit and integration tests #68

Open
gbowne1 opened this issue Jul 17, 2023 · 3 comments
Open

[BUG][Feature] Write e2e, unit and integration tests #68

gbowne1 opened this issue Jul 17, 2023 · 3 comments
Labels
bug Something isn't working devops This is a devops feature or issue documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@gbowne1
Copy link
Owner

gbowne1 commented Jul 17, 2023

Right now currently our App.test.js fails.

Write some e2e, unit and integration tests for our app with:

@testing-library (React Testing Library)
Jest
Cypress
Mocha
Chai
Axios (axios can test API endpoints l)
Jasmine

Jest and RTL are built in this app, so that might be a good place to start. But I am ok with using any of these.

@gbowne1 gbowne1 added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested devops This is a devops feature or issue labels Jul 17, 2023
@gbowne1 gbowne1 moved this to Todo in CodeBooker Jul 17, 2023
@gbowne1
Copy link
Owner Author

gbowne1 commented Jul 17, 2023

These are all well documented and there are plenty of video resources on YouTube if you're not familiar with any of these.

@gbowne1
Copy link
Owner Author

gbowne1 commented Jul 25, 2023

App.test.js is currently the default that ships with create react app. This file would test the overall functionality of the app and/or App.js

We also need to house tests in a /test or /tests folder so we can divide up each type of tests. Some choose to keep tests within each component and page in the app.

@gbowne1
Copy link
Owner Author

gbowne1 commented Aug 4, 2023

Here are some things we should be testing.

We will be using Jest and React Testing Library.

Test the rendering of React components: Ensure that the components render correctly and display the expected content.

Test user interactions: Simulate user interactions such as clicking buttons, submitting forms, and navigating through the app to verify that the expected actions are triggered.

Test API endpoints: Use Jest and Supertest to test the API endpoints, making requests and asserting the expected responses.

Test data retrieval: Verify that data is fetched correctly from the MongoDB database and displayed in the app.

Test data submission: Simulate form submissions and ensure that data is correctly sent to the server and stored in the database.

Test authentication and authorization: Validate that authentication and authorization mechanisms are working as expected, such as logging in, accessing protected routes, and restricting access to unauthorized users.

Test error handling: Check that error messages are displayed correctly when errors occur, both on the client-side and server-side.

Test state management: Verify that the state is updated correctly when actions are triggered, such as adding a book recommendation or updating a review.

Test component interactions: Test how different components interact with each other, such as passing data between parent and child components or triggering actions based on events in other components.

Test edge cases and error scenarios: Cover scenarios where unexpected inputs or errors occur, and ensure that the app handles them gracefully without crashing or displaying incorrect information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working devops This is a devops feature or issue documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
Status: Todo
Development

No branches or pull requests

1 participant