Skip to content

Conversation

@Gennon
Copy link
Contributor

@Gennon Gennon commented Feb 9, 2023

Added some end to end tests using Playwright.

It requires that you are running the api locally on localhost:4000 and the React Intro application on localhost:3000.

This is meant to be part of the course so that the students can have a look at how it is possible to do e2e tests.

It is not optimal, but it will highlight some useful methods in testing.

@Gennon Gennon requested review from anhtin and susansem February 9, 2023 08:27

fastify.post("/colleagues", (req, res) => {
const colleague = JSON.parse(req.body);
const colleague = req.body;
Copy link
Member

Choose a reason for hiding this comment

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

Note, req.body defaults to a string if the request does not specify Content-Type: application/json. Might want to add if-statements checking the header and manually deserialize the body or return 415 Unsupported Media Type when content type is something else. Some of the previous participants were confused when seemingly correct requests didn't go through as they weren't aware that the header is neccessary.

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.

3 participants