testing-common.module.ts 889 B

123456789101112131415161718192021222324
  1. import { CommonModule } from '@angular/common';
  2. import { NgModule, Provider } from '@angular/core';
  3. import { ClarityModule } from '@clr/angular';
  4. import { DataService, FormFieldComponent, FormFieldControlDirective } from '../lib/core/src/public_api';
  5. import { MockTranslatePipe } from './translate.pipe.mock';
  6. const DECLARATIONS = [MockTranslatePipe, FormFieldComponent, FormFieldControlDirective];
  7. const PROVIDERS: Provider[] = [{ provide: DataService, useValue: {} }];
  8. /**
  9. * This module is for use in unit testing, and provides common directives and providers
  10. * that are used across most component, reducing the boilerplate needed to declare these
  11. * in each individual test.
  12. */
  13. @NgModule({
  14. imports: [CommonModule, ClarityModule],
  15. exports: [...DECLARATIONS, ClarityModule],
  16. declarations: DECLARATIONS,
  17. providers: PROVIDERS,
  18. })
  19. export class TestingCommonModule {}