Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockPipe #14

Open
appienvanveen opened this issue Dec 7, 2017 · 1 comment
Open

MockPipe #14

appienvanveen opened this issue Dec 7, 2017 · 1 comment

Comments

@appienvanveen
Copy link

Hi!

First of all, many thanks for your library.

When I was creating tests for my angular app, it appeared there was no proper way to mock pipes. Therefore I've created an MockPipe function based on your MockComponent code.

Is this maybe you can use/add in your ng-mock-component code? See below the code:

import {Pipe, PipeTransform} from '@angular/core';

/**
 * Examples:
 * MockPipe('mypipe');
 */
export function MockPipe(name: string): any {
  @Pipe({ name })
  class MockPipe implements PipeTransform {
    transform (input: any): any {
      return input;
    }
  }
  return MockPipe;
}
@appienvanveen
Copy link
Author

@cnunciato Any comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant