Skip to content

Latest commit

 

History

History
87 lines (48 loc) · 2.5 KB

README.md

File metadata and controls

87 lines (48 loc) · 2.5 KB

Weather Monster - Demo

Search and select cities to see their min and max temperatures.

Installation

In order to run the app you need install dependencies.

npm

Installing dependencies via npm:

cd /project/root/directory

npm i

yarn

Installing dependencies via npm:

cd /project/root/directory

yarn install

Running the app

Once all the dependencies are installed, you can run the app from the project root directory with:

npm

npm start

yarn

yarn start

Open http://localhost:3000 to view it in the browser.

Tests

This app is shipped with unit and integration tests. Unit tests are written using Jest and Enzyme and integration tests are written in Cypress.

Unit tests

npm run test
or
yarn test

Runs all the unit tests and launches the test runner in the interactive watch mode.

Code coverage

Generate unit test code coverage report with:

npm run test:coverage
or
yarn test:coverage

Integration tests

Cypress is configured in such a way that it could run integration tests on command line. When it finishes it generates .mp4 video about how the app behaved during tests.

Before running Cypress, make sure the app is running. Run Cypress in command line with:

npm run test:e2e:run
or
yarn test:e2e:run

In order to view all the tests available and watch them running in browser, open Cypress GUI with:

npm run test:e2e:open
or
yarn test:e2e:open

Configuration (src/config.js)

However, this is not a mature app yet, you can configure following options in src/config.js the way you want.

  • App name
  • Search field placeholder text
  • Notification messages (Error, loading data and empty state)
  • Temperature units

For example, the default units of temperature are set to metric i.e. Celsius. In order to change it to imperial i.e. fahrenheit, refer src/constants.js to find the name of constant variable and use in src/config.js. Therefore, in src/config.js, change:

export const units = constants.units.METRIC
with
export const units = constants.units.IMPERIAL

Notes

Since free version of https://openweathermap.org/current is not CORS enabled, therefore, a proxy is used in order to access it. Check src/endpoint/index.js for more details.