From 721b553d60b328992f6f261ce3c77de66cfbb4ea Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Wed, 13 Nov 2019 17:35:37 +0100 Subject: [PATCH] fix(@schematics/angular): uniformize guard spec with service spec The current guard spec schematic uses `inject` whereas we dropped it for the service spec a while ago. This commits updates the guard spec schematic to be similar to the current service spec. (cherry picked from commit f3259df1c649f07f0c8c90db72fb1c723bacb85b) --- .../files/__name@dasherize__.guard.spec.ts.template | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template b/packages/schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template index 9a915c19b379..0ce1ff44c67c 100644 --- a/packages/schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template +++ b/packages/schematics/angular/guard/files/__name@dasherize__.guard.spec.ts.template @@ -1,15 +1,16 @@ -import { TestBed, async, inject } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { <%= classify(name) %>Guard } from './<%= dasherize(name) %>.guard'; describe('<%= classify(name) %>Guard', () => { + let guard: <%= classify(name) %>Guard; + beforeEach(() => { - TestBed.configureTestingModule({ - providers: [<%= classify(name) %>Guard] - }); + TestBed.configureTestingModule({}); + guard = TestBed.inject(<%= classify(name) %>Guard); }); - it('should ...', inject([<%= classify(name) %>Guard], (guard: <%= classify(name) %>Guard) => { + it('should be created', () => { expect(guard).toBeTruthy(); - })); + }); });