Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests #8

Merged
merged 8 commits into from
Nov 10, 2023
Merged
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ jobs:
node-version: 18
- run: npm ci
- run: npm run lint
- run: npm run test
- run: npm run build
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
node-version: 18
- run: npm ci
- run: npm run lint
- run: npm run test

release:
if: "!startsWith(github.event.head_commit.message, '[skip ci]')"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Then you need a DynamoDB table set up in your region of choice with the structur

This partition key is used to index the different endpoints which cache is enabled for. This enables the database to do 1:1 lookups, so it runs as fast as possible.

You can also see how we are setting up the table in the `/test/setupDatabase.sh` script, which sets up a locally DynamoDB instance and creates the table inside of the instance.
You can also see how we are setting up the table in the `/local_testing/setupDatabase.sh` script, which sets up a locally DynamoDB instance and creates the table inside of the instance.

## Usage

Expand Down Expand Up @@ -92,7 +92,7 @@ This repository contains two projects. One for the source code itself, and the o

To build the package/plugin you need to be in the root directory: `fastify-aws-dynamodb-cache` and afterwards can you run the NPM script `npm run pack:local`. You'll need to install the different modules, for the source code. You can do this via npm: `npm install`, when you are in the root directory.

To then install the package and run the test server, you can change directory _cd_ into the `test` folder, where you can run the NPM script `npm run start`. This installs the package which is packaged in a `.tgz` file in the root directory.
To then install the package and run the test server, you can change directory _cd_ into the `local_testing` folder, where you can run the NPM script `npm run start`. This installs the package which is packaged in a `.tgz` file in the root directory.

After you have changed something in the package again, you'll need to run both `npm run pack:local` and then `npm run start`, to see the latest changes you have made.

Expand Down
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
rootDir: "tests",
};
8 changes: 4 additions & 4 deletions test/package-lock.json → local_testing/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading