# inject Function deprecated alias
Module | import { inject } from "@tsed/testing" |
---|---|
Source | /packages/testing/src/inject.ts |
# Overview
function inject<T>(targets: any[], func: (...args: any[]) => Promise<T> | T): () => Promise<T>;
# Description
The inject function is one of the TsExpressDecorator testing utilities. It injects services into the test function where you can alter, spy on, and manipulate them.
The inject function has two parameters
- an array of Service dependency injection tokens,
- a test function whose parameters correspond exactly to each item in the injection token array.
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing