ngneat/spectator

createPipe doesn't pickup arguments to pipes

martin-juul opened this issue · 3 comments

Is this a regression?

No

Description

When testing a pipe it is not possible to pass arguments to the pipe.

describe('FooPipe', () => {
  let spectator: SpectatorPipe<FooPipe>;
  const createPipe = createPipeFactory(FooPipe);

  it('should change the background color', () => {
    // @ts-ignore used in template
    const model = {a: 1, b: 2, c: 3};

    spectator = createPipe(`<div>{{ 'EUR 0' | fooPipe: model }}</div>`, {
      hostProps: model,
    });

    expect(spectator.element).toHaveText('foobar');
  });
});

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

TypeError: Cannot read property 'tender' of undefined
    at FooPipe.transform (projects/foo/src/app/foo.ts:13:15)
    at pureFunction2Internal (node_modules/@angular/core/fesm2015/core.mjs:22302:1)
    at ɵɵpipeBind2 (node_modules/@angular/core/fesm2015/core.mjs:22484:1)
    at HostComponent_Template (ng:///HostComponent.js:14:33)
    at executeTemplate (node_modules/@angular/core/fesm2015/core.mjs:9717:1)
    at refreshView (node_modules/@angular/core/fesm2015/core.mjs:9580:1)
    at refreshComponent (node_modules/@angular/core/fesm2015/core.mjs:10777:1)
    at refreshChildComponents (node_modules/@angular/core/fesm2015/core.mjs:9376:1)
    at refreshView (node_modules/@angular/core/fesm2015/core.mjs:9630:1)
    at renderComponentOrTemplate (node_modules/@angular/core/fesm2015/core.mjs:9697:1)

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

This is by default HostComponent as can be seen in

my bad :D