Skip to content

Support to mock InjectionTokensΒ #725

@Abuntxa

Description

@Abuntxa

Description

When configuring dependency injection and specially when working with microfrontends, our container often registers services that are accessible to the microfrontends using shared injection tokens. These injection tokens are distributed using npm packages that refer to an injectiontoken of an interface.
When trying to make tests in the microfrontends with spectator, spectator does not support the mocking of the InjectionTokens directly, and the microfrontend does not have the implementation of the service to create the mock of the real implementation as the npm package only contains the interface.

Proposed solution

Mimic the implementation in ngMocks library for InjectionTokens not to have different mocking libraries.

Alternatives considered

Currently when ever I encounter a situation like this I use ngMocks library.

Do you want to create a pull request?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions