version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10.13.0
    working_directory: /home/circleci/app
    steps:
      - checkout

      - restore_cache:
          key: v1-dep-{{ checksum "yarn.lock" }}

      - run:
          name: Install deps
          command: yarn install --frozen-lockfile

      - save_cache:
          paths:
            - ./node_modules
            - ~/.cache
          key: v1-dep-{{ checksum "yarn.lock" }}

      - run:
          name: Run tests
          command: yarn test