@forinda/kickjs-testing
v1.4.0
Published
Test utilities, TestModule builder, and helpers for KickJS applications
Maintainers
Keywords
Readme
@forinda/kickjs-testing
Test utilities for KickJS — createTestApp and createTestModule helpers.
Install
# Using the KickJS CLI (recommended — installs as dev dependency)
kick add testing
# Manual install
pnpm add -D @forinda/kickjs-testingFeatures
createTestApp()— creates an Application instance for testing (resets container, empty middleware)createTestModule()— builds a dynamic test module with custom DI registrations- DI overrides for mocking repositories and services (supports symbol keys)
Quick Example
import { createTestApp } from '@forinda/kickjs-testing'
import { describe, it, expect } from 'vitest'
import supertest from 'supertest'
describe('UserController', () => {
it('lists users', async () => {
const { expressApp } = createTestApp({
modules: [UserModule],
overrides: {
[USER_REPO]: new MockUserRepository(),
},
})
const res = await supertest(expressApp).get('/api/v1/users')
expect(res.status).toBe(200)
})
})Documentation
License
MIT
