Skip to content

Commit 4bbf756

Browse files
authored
Add tests (#9)
* fix: use nullish coalescing to respect an empty prefix * fix: handle failed cache deletion * revert: handle failed deletion * fix: throw CacheRemoveError if it fails to remove cache * test: add tests * run lint * fix: change moduleResolution * fix: cause type * run lint
1 parent 738c2de commit 4bbf756

File tree

9 files changed

+3485
-176
lines changed

9 files changed

+3485
-176
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ jobs:
2424
uses: actions/setup-node@v2
2525
with:
2626
node-version: ${{ matrix.node-version }}
27-
cache: "npm"
27+
cache: 'npm'
28+
2829
- run: npm ci
29-
- run: npm run build --if-present
30-
- run: npm test
30+
31+
- name: Start test services
32+
run: npm run test:services:start
33+
34+
- run: npm run lint
35+
36+
- name: Run tests
37+
run: npm test

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,15 @@ But, there're still some primitives that `serialize` cannot handle.
7070
If you need to serialize these types of data, you should using a custom [serializer](https://mikro-orm.io/docs/serializing#property-serializers) or [custom type](https://mikro-orm.io/docs/custom-types)
7171

7272
If you're in debug mode, you will see JSON stringified data at your console. This is solely for debugging purposes. `serialize` is used for actual cache.
73+
74+
## Testing
75+
76+
You need docker compose to run the tests.
77+
78+
```bash
79+
# Start test services
80+
npm run test:services:start
81+
82+
# Run tests
83+
npm test
84+
```

docker-compose.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
redis:
3+
image: redis:alpine
4+
ports:
5+
- "6379:6379"

0 commit comments

Comments
 (0)