Giter Club home page Giter Club logo

check-my-diary's Introduction

CircleCI Known Vulnerabilities

Check My Diary

A progressive web application for viewing shift pattern and detail. It consists of a Node.JS application with a postgres database and calls out to Prison Officer Diary API to get shift and task information, as well as notify to send emails and SMS.

Cloning the Repo

git clone [email protected]:ministryofjustice/check-my-diary.git
cd check-my-diary
npm i

Setting environment variables

template.env contains all the enviroment variables need for running this app.

Ask a contributor for any values you need then rename this file to .env

Build assets

npm run build

Start the app.

Ensure you build assets first

npm start

Running the app in "watch mode"

npm start:dev

Running the app locally against local service

  1. Remove any running docker containers docker-compose down --rm all
  2. In this repository run docker-compose up
  3. Remote into docker database to create your user
  • docker exec -it check-my-diary-db psql -U [DATABASE-NAME-FROM-.ENV]
  • INSERT INTO "UserAuthentication"("QuantumId", "EmailAddress", "Sms", "UseEmailAddress", "UseSms", "ApiUrl")VALUES ('your-name', '', '', false, false, 'https://api.check-my-diary-dev.hmpps.dsd.io/api/');
  1. Clone and cd into cmd-api
  2. Run cmd-api
  3. Start app in dev mode, in check-my-diary run npm start:dev

Run linter

npm run lint

Running tests

Jest is used to run the tests:

npm install
npm test

Running integration tests

The integration tests are also run using jest, but separated out from the unit tests as they require a database and a wiremock instance.

NB: To run integration tests you must remove your .env from scope so that config.js uses defaults

To start the docker images for the tests:

docker-compose -f docker-compose-test.yml pull && docker-compose -f docker-compose-test.yml up

This will start an database instance on port 5432 and a wiremock instance on port 9191 to mock out the prison officer and notify APIs. This allows us to simulate both services without firing them up.

The tests are written using cypress and will test against a running application instance. To start up the application for running the feature tests:

npm run start-feature

To run the tests from the command line:

npm run int-test

This will run all the specifications in the integration_tests package.

To run the tests using the cypress runner:

npm run int-test-ui

This will open up cypress and show all the specs. Clicking on one of the specs will fire up chrome and run the tests in that specification.

If the mocking is not working properly after the test has been completed then the docker terminal will show what stubs aren't matched by requests. http://localhost:9191/__admin/requests will provide more information on the requests that are made and http://localhost:9191/__admin/mappings will show what stubs have been created for the requests.

check-my-diary's People

Contributors

astroash avatar ewastempel avatar fareed-mohammed avatar jhackettpps avatar jonhindle avatar mattops avatar mjwillis avatar monskapinga avatar nickb834 avatar petergphillips avatar romidane avatar sgsollie avatar simonmitchellmoj avatar whitfield-mj avatar zali-moj avatar

Watchers

 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.