# inject Function

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.