datopian/data-api

Add test setup

EvgeniiaVak opened this issue · 1 comments

epic here: #1

When developing data-api app I want to have test framework setup and ready to be able to write unit tests during development.

Acceptance criteria

  • There is a test framework in the repo with a smoke test written and passing
  • There is a mock framework in the repo used throughout tests

Tasks

  • Find the framework to use (Supertest remains the default for node http server tests ...)
  • Write a simple smoke test (e.g. something like / page returns some response)
  • Setup github CI to run the tests on PR to master branch
  • Create a PR to tests that it's working
  • Setup mocks / fixtures i.e. the fixture postgres database (For mocks we can either use nock (example of using nock here - https://github.com/datopian/frontend-v2) or mitm.js - interesting to give a try)

    this should probably be after setting up graphql endpoint to see what kind of mocks we will need (and generate them easily)

    • Write a test using a fixture (a simple one that tests functionality working out of the box)

DUPLICATE. Will be doing integration tests mostly, see #4