Giter VIP home page Giter VIP logo

pokemon's Introduction

Pokemon App

This React Native application retrieves a list of Pokemon from a given API and displays their details upon selection. The app uses Redux Toolkit, RTK Query, and React Navigation for state management, data fetching, and navigation respectively. Unit tests are written using Jest and React Testing Library.

Features

  • Fetch and display a list of Pokemon.
  • Show detailed information about a selected Pokemon.
  • Persistently store the Pokemon list.
  • Navigation between Home and Detail screens.
  • Unit tests with over 60% coverage.

Prerequisites

Before you begin, ensure you have met the following requirements:

Installation

  1. Clone the repository:

  2. Install dependencies:

    npm install
  3. Set up environment variables:

    Create a .env file in the root directory and add the following line:

    API_URL=https://pokeapi.co/api/v2/pokemon/
  4. Set up Android development environment:

Add local.properties file in the android directory to include the path to your Android SDK:

sdk.dir=C://Users//USERNAME//AppData//Local//Android//Sdk

Replace USERNAME with your actual Windows username. For macOS/Linux, the path might be different.

Running the App

Android

  1. Start the Android emulator or connect an Android device.

  2. Run the following command:

    npm run android

Running Tests

To run the unit tests, execute:

npm run test

Unit Testing

Home Screen Tests

  • Renders loading state correctly
  • Renders error state correctly
  • Renders list of Pokemon correctly
  • Navigates to detail screen when Pokemon is pressed

Detail Screen Tests

  • Renders loading state correctly
  • Renders error state correctly
  • Sets navigation title to Pokemon's name with the first letter capitalized
  • Handles empty data gracefully

pokemon's People

Contributors

hammadsaeedtp avatar

Watchers

Ahmed Hammad Saeed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.