From 3634575d899423cf46c75fda32d25a5c2a516b50 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 23 Aug 2018 12:45:39 +0200 Subject: [PATCH] test(common): fix double instantiation in NgSwitch test (#25632) One of the tests was creating TestComponent instance _and_ using global state making this test not predictable. Fixing the test by making sure that TestComponent is instantiated only once. PR Close #25632 --- packages/common/test/directives/ng_switch_spec.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/common/test/directives/ng_switch_spec.ts b/packages/common/test/directives/ng_switch_spec.ts index 3adf2a1614..9d78c6f6d9 100644 --- a/packages/common/test/directives/ng_switch_spec.ts +++ b/packages/common/test/directives/ng_switch_spec.ts @@ -133,9 +133,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; ''; TestBed.configureTestingModule({declarations: [TestDirective]}); - TestBed.overrideComponent(TestComponent, {set: {template: template}}) - .createComponent(TestComponent); - const fixture = TestBed.createComponent(TestComponent); + const fixture = createTestComponent(template); fixture.componentInstance.switchValue = 'a'; fixture.detectChanges();