How to mock Pipe when testing Component

Discussão em 'Angular' iniciado por harunurhan, Outubro 16, 2024.

  1. harunurhan

    harunurhan Guest

    Currently I am overriding providers to use mocked services like this:

    beforeEach(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
    tcb.overrideProviders(AddFieldToObjectDropdownComponent,
    [
    provide(ServiceA, { useClass: MockServiceA })),
    provide(ServiceB, { useClass: MockServiceB }))
    ])
    ...


    I want to do same thing for pipes that the component uses. I tried, provide(PipeA, { useClass: MockPipeA }) and provide(PipeA, { useValue: new MockPipeA() }) but both didn't work.

    Continue reading...

Compartilhe esta Página