This test should take overall no longer than 3 hours. Should you find yourself taking longer please submit what you have, with a note indicating how you would finish the task.
Please clone this repository in order to work on it.
You have been supplied with a partially complete mini React application, consisting of a simple login form for a fictitious medical records app.
The application requires refactoring and completion. Please complete the functionality of the app and refactor the code in accordance with your understanding of the best practice.
Feel free to use any technology available in the React environment to achieve the results.
- Validate input fields:
- username:
- matching email address pattern only
- max 128 characters between '@' and '.'
- max 6 characters after last '.' character
- password:
- alphanumeric only
- min 8 characters
- max 128 characters
- at least one number
- at least one capital letter
- username:
- Allow logging in based on the response from this API endpoint: https://run.mocky.io/v3/3669c83a-9ba1-4424-b08f-a8ef6d699966 The payload should be a JSON object of the form { "username": "test.user@xxxx.co", "password": "testpassword" } A successful login will have a response with a 200 HTTP status code An unsuccessful login will have a response with a 401 HTTP status code
- After a successful response has been received, use it to render a page listing hospital patients following the design attached in 'digital-hospital-global-patients.jpg'.
- This page should not be available to users who are 'unauthenticated'. Those users should be presented with the login page instead.
- Please use Redux to manage the state of the app and place any HTTP requests in action dispatcher.
- Group patients by the "type" property and display users only whose "is_completed" value is false.
- Please sort users ascending within groups by "last_visit_date" or alphabetically if dates are the same.
- Add tests to the most crucial parts of the application logic (Testing-library/Jest preferable)
Add functionality to remove whole groups and/or users.
- New routes could be added in the future, some routes will require that the user has been authenticated
- Some common data may need to be accessed by future components.
- Styling code should be reusable in the future
- Class names should follow modern naming conventions
- Inputs should have behaviour appropriate to their function
- Potential future code changes should introduce minimal regression bugs without developers being aware