@angular/core/testing#TestBedStatic TypeScript Examples

The following examples show how to use @angular/core/testing#TestBedStatic. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: test_utils.ts    From nestjs-angular-starter with MIT License 7 votes vote down vote up
/**
 * Returns the common test bed to be used across all of the project.
 * @param declarations
 * @param providers
 */
export function getCommonTestBed(
  declarations: unknown[],
  imports: unknown[] = [],
  providers: unknown[] = []
): TestBedStatic {
  const testBed = TestBed.configureTestingModule({
    declarations: [...declarations],
    imports: [MockCoreModule, SharedModule, ...imports],
    providers: [...providers],
  });

  return testBed;
}
Example #2
Source File: mock-mat-icon.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
export function overrideIconModule(testBed: TestBedStatic): TestBedStatic {
  return testBed.overrideModule(MatIconModule, {
    remove: {
      declarations: [MatIcon],
      exports: [MatIcon],
    },
    add: {
      declarations: [MockMatIconComponent],
      exports: [MockMatIconComponent],
    },
  });
}