This repo provides a sample Node.js REST API that makes calls out to an external GraphQL endpoint and returns the Graph data to the user.
Sample tests are included that mock the GraphQL integration. Mocks are defined using the Jest Testing Framework.
Install the dependencies with the following command:
npm install
To run a build and launch the development server, execute:
npm start
Once completed, the app should be avialable at the following routes:
Returns a list of recent hikes.
Returns data describing hike 123
.
Returns a list of photos taken during hike 123
.
Unit tests can be executed with by running the following command:
npm test
Tests can be executed with a debugger in VS Code using the Jest Runner extension. If running VS Code in WSL mode, make sure the Jest Runner extension is installed and enabled for use with WSL.
This application was bootstrapped with Express Application Generator, and was developed with Node.js version v16.13.1
Here is a blog post I created that explains the setup and testing in further detail: https://taylor.callsen.me/testing-node-js-integrations-with-jest/