Skip to content

Commit

Permalink
Merge pull request #8 from blastorg/unit-tests
Browse files Browse the repository at this point in the history
unit tests
  • Loading branch information
fredrikj31 authored Nov 10, 2023
2 parents c467490 + 4a9da49 commit bee17a0
Show file tree
Hide file tree
Showing 14 changed files with 8,050 additions and 3,043 deletions.
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

0 comments on commit bee17a0

Please sign in to comment.