version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10.16

    working_directory: ~/repo

    steps:
      - checkout
      - run:
          name: update-npm
          command: 'sudo npm install -g npm@latest'

      - restore_cache: 
          key: dependency-cache-{{ checksum "package.json" }}

      - run:
          name: install-npm-wee
          command: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run: 
          name: run-test
          command: npm test