Skip to content

KinanKazmi/pokemon

Repository files navigation

Getting Started

Note: After cloning the project, make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step, before proceeding.

Step 1: Installing dependencies

# using npm
npm install

Step 2: Start the bundler

# Normal/ with-Staging APIs
npm run start
npm run start:stag

# Production APIs
npm run start:prod

For Android

npm run android

For iOS

npm run ios

Project details

  1. Since the styling wasn't mentioned in the task document, I've kept the styling to a minimum.
  2. As mentioned in the package.json, start:stag and start:prod scripts will pickup relevant env variables from .env.prod and .env.stag (default) files and use them. Its being used in api.ts file.
  3. Keeping .env files in the repo as well so you can use it (not added in gitIgnore)
  4. Theres no input in the app, so keeping the tests to a minimum as well (excluding typescript, to keep it clean). Currently I have written 2 tests for the Main and Details views. The tests mock the best case scenario, after the RTK query hook's positive response. Further tests can be written by changing the mock data responses of the hook queries for both views. e.g. before loading, error in response, while waiting for response and etc.
  5. use npm test
# For all files within the __test__ folder
npm test
# For individual files within the __test__ folder (npm test <filename>)

npm test Main.test
npm test Details.test
  1. For persistent storage, I used react-native-mmkv library which has encription support as well. It wasn't clear how the data was to be stored and used locally so I just added it to Main.tsx file in the useEffect for now. Its being hosted and exported from the file localstore.ts.