Skip to content

Commit

Permalink
test(core): Remove manual ComponentFixture construction (angular#52983)
Browse files Browse the repository at this point in the history
Tests still pass when using TestBed.createComponent directly

PR Close angular#52983
  • Loading branch information
atscott authored and tbondwilkinson committed Dec 6, 2023
1 parent cd4aad6 commit 9bf29b2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/core/test/linker/ng_module_integration_spec.ts
Expand Up @@ -10,7 +10,7 @@ import {Compiler, Component, CUSTOM_ELEMENTS_SCHEMA, Directive, forwardRef, getM
import {ɵɵdefineInjectable} from '@angular/core/src/di/interface/defs';
import {NgModuleType} from '@angular/core/src/render3';
import {getNgModuleDef} from '@angular/core/src/render3/definition';
import {ComponentFixture, inject} from '@angular/core/testing';
import {ComponentFixture, inject, TestBed} from '@angular/core/testing';

import {InternalNgModuleRef, NgModuleFactory} from '../../src/linker/ng_module_factory';
import {clearModulesForTest, setAllowDuplicateNgModuleIdsForTest} from '../../src/linker/ng_module_registration';
Expand Down Expand Up @@ -101,13 +101,9 @@ describe('NgModule', () => {
componentDef.TView = null;
}

const ngModule = createModule(moduleType, injector);
createModule(moduleType, injector);

const cf = ngModule.componentFactoryResolver.resolveComponentFactory(compType)!;

const comp = cf.create(Injector.NULL);

return new ComponentFixture(comp, null, null, false);
return TestBed.createComponent(compType);
}

describe('errors', () => {
Expand Down

0 comments on commit 9bf29b2

Please sign in to comment.