@forinda/kickjs-testing 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @forinda/kickjs-testing
|
|
2
|
+
|
|
3
|
+
Test utilities for KickJS — `createTestApp` and `createTestModule` helpers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @forinda/kickjs-testing
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- `createTestApp()` — creates an Application instance for testing (resets container, empty middleware)
|
|
14
|
+
- `createTestModule()` — builds a dynamic test module with custom DI registrations
|
|
15
|
+
- DI overrides for mocking repositories and services (supports symbol keys)
|
|
16
|
+
|
|
17
|
+
## Quick Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { createTestApp } from '@forinda/kickjs-testing'
|
|
21
|
+
import { describe, it, expect } from 'vitest'
|
|
22
|
+
import supertest from 'supertest'
|
|
23
|
+
|
|
24
|
+
describe('UserController', () => {
|
|
25
|
+
it('lists users', async () => {
|
|
26
|
+
const { expressApp } = createTestApp({
|
|
27
|
+
modules: [UserModule],
|
|
28
|
+
overrides: {
|
|
29
|
+
[USER_REPO]: new MockUserRepository(),
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const res = await supertest(expressApp).get('/api/v1/users')
|
|
34
|
+
expect(res.status).toBe(200)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
[Full documentation](https://github.com/forinda/kick-js)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-testing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Test utilities, TestModule builder, and helpers for KickJS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@forinda/kickjs-core": "0.3.
|
|
19
|
-
"@forinda/kickjs-http": "0.3.
|
|
18
|
+
"@forinda/kickjs-core": "0.3.1",
|
|
19
|
+
"@forinda/kickjs-http": "0.3.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@swc/core": "^1.7.28",
|