Welcome 👋 For this assignment, we'll use the Star Wars API.
Implement and test a GET request to the Star Wars "people" endpoint: https://swapi.dev/api/people
Your application will display the name
of the first character entry within the response ... some chap called Luke, apparently.
- Fork and clone this repo, and create a new React app within it
- Have your React app fetch and display the data specified in the brief
- Mock (or "stub") the API response with msw
- Implement a test to check the first person that your mock server returns is rendered as expected.
Write tests for the following scenarios:
- the API responds with Status Code 500 (Internal Server Error); your component displays the error message
"🤕 Something went wrong; try again."
- the API responds with Status Code 418 (I’m a tea pot); your component displays an error message saying
"🫖 I'm a tea pot, silly."
- This exercise is not about what your app looks like so don’t worry about styling!
- You will need to create a React app from scratch and strip out excess boiler plate.
- You will need to make an API call – think, 🫂 fetch and useEffect 🫂
- Ensure your test query works with async-await
- Remember to commit little and often to GitHub, and to keep your commit messages nice and descriptive
- Take time to ensure your README explains how to run your app! 🔥