TestingModule
Provides access to the test application, container, HTTP client, and utilities.
const module = await Test.createTestingModule({ modules: [RegistrationModule],}).compile()// Make HTTP requestsconst response = await module.http .post('/api/v1/register') .withBody({ ... }) .send()// Access servicesconst service = module.get(REGISTRATION_TOKENS.RegistrationService)// Cleanupawait module.close() Copy
const module = await Test.createTestingModule({ modules: [RegistrationModule],}).compile()// Make HTTP requestsconst response = await module.http .post('/api/v1/register') .withBody({ ... }) .send()// Access servicesconst service = module.get(REGISTRATION_TOKENS.RegistrationService)// Cleanupawait module.close()
Get Application instance
Get DI Container
Get HTTP test client for making requests
Get fake storage service for assertions
Provides assertion helpers for testing file storage operations.
module.storage.assertExists('path/to/file.pdf')module.storage.assertMissing('deleted/file.pdf')module.storage.clear() // Reset between tests Copy
module.storage.assertExists('path/to/file.pdf')module.storage.assertMissing('deleted/file.pdf')module.storage.clear() // Reset between tests
Cleanup - call in afterAll
Execute an HTTP request through RouterService
This is the core method - calls RouterService.fetch() directly, no SELF.fetch()
Resolve a service from the container
Run callback in request scope (for DB operations, service access)
TestingModule
Provides access to the test application, container, HTTP client, and utilities.
Example