This is the FrontEnd test. Please NOTE: This site has been used and tested ONLY on Chrome.
For this test, I've used the following techs:
- Vite
yarn create vite [app-name] --template react-ts
- React 18.2
- React Hooks (custom and pre-defined)
- Javascript
- Typescript
- SASS
- react-hook-form (to handle all the parts of the search field)
- Axios (for API requests)
- Zod (for schema validation)
- react-router (v6.2)
- Testing: vitest, react-testing-library & jsdom
I've also used the .env file (which has been committed to this repo). Please note that in a normal job scenario, I would never commit .ENV files to the repo.
Firstly, please follow these instructions:
- Go to your terminal and open the folder where you want to clone the app
- Copy and paste the following line to bootstrap the app:
git clone https://github.com/devolab/github-user-search-test.git
- Once the clone has been completed, write:
github-user-search-test
- Write:
yarn
to install the node_modules - To start the development environment, run:
yarn dev
- Your browser should open running the application on
localhost:3000
. If it doesn't, please open a new browser window and type:localhost:3000
I have made a few unit testing for some of the components. Due to time restrictions, I haven't tested the whole app. I hope it's enough.
To run tests, run the following script, and all files ending in .test.tsx
will be evaluated:
$ yarn test
I've also included a coverage script. Please run this command:
$ yarn coverage
In both of the above cases, it will run vitest
I use a feature-driven approach when I need to map the requirements. In Jira, I create 1 story for each CRUD. Eg: Form to onboard users (POST) or Table to display users (GET) Each story has a number of subtasks which are usually very small and easy to estimate. Here are some examples of a feature story and subtasks based on this test requirements:
- Write TDD unit testing
- Create an empty component
- Add a Big image and size it with CSS
- Make the image mobile friendly
- Add sub-description text which says: "...."
- Write CSS
- Write TDD unit testing
- Create an empty component
- Add a Field with libraries
- Create field validation
- Write CSS
..etc..
GitHub development and deployment structure are based on the stories. This is what I do branch-wise:
- Create a Branch with the
Story Number / Title
- Create sub-tasks which I complete and commit/merge to the
Feature branch (story branch)
- Once the Feature branch is completed (the story is completed), I merge it with the
development
branch - After a quick smoke test in the
development
branch, I merge it with theintegration
branch for QA - If QA passes, I then merge it with the
staging
branch to allow testing from the client - If the client is happy, we plan a production release (no Fridays and no before holidays)
I spent a good 15/30min minutes understanding the requirements and mapping the application on a piece of paper. On paper, I try to map the app architecture, flows, possible errors, and what they should be. This would lead to creating UX designs, but this is usually a job for people with design expertise.
When I get to the code, I start refactoring the basic react folder structure, by moving app.tsx / scss in a separate folder.
Then I installed the dependencies I needed. Eg: Axios
, react-router
, etc...
I normally start from one component, and as soon as I start adding states
and/or useEffect
etc.., I decouple them into smaller components by following the S.O.L.I.D principles and dependency injection methodology. For CSS, unless I am using a framework (bootstrap, MUI, etc..), which I personally do not like, I create a structure of SCSS/SASS file with an index to reference all of them in one.
Unit testing is usually done down to the file level, to keep as many things together.
That's it!!