Skip to content

Function: mockContainer()

ts
function mockContainer(options?: MockContainerOptions): Container;

Defined in: src/wirestate-core/test-utils/mock-container.ts:48

Mocks and configures an Inversify Container for testing.

Parameters

ParameterTypeDescription
optionsMockContainerOptionsConfiguration options for the mock container.

Returns

Container

A configured Inversify Container.

Remarks

This utility initializes a new container via createContainer and binds the provided entries using mockBindEntry. It can also automatically resolve (activate) all or a subset of services.

Throws

If an identifier in activate is not found in entries.

Example

typescript
const container: Container = mockContainer({
  entries: [UserService, AuthService],
  activate: true
});