Skip to content

Commit a7bfef7

Browse files
cexbrayatfilipesilva
authored andcommitted
feat(@schematics/angular): simplify service test
Now that the service schematic uses `providedIn` by default, we can simplify the test to use `TestBed.configureTestingModule({})`. Also use `TestBed.get()` instead of the `inject` wrapper.
1 parent c35b44c commit a7bfef7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import { TestBed, inject } from '@angular/core/testing';
1+
import { TestBed } from '@angular/core/testing';
22

33
import { <%= classify(name) %>Service } from './<%= dasherize(name) %>.service';
44

55
describe('<%= classify(name) %>Service', () => {
6-
beforeEach(() => {
7-
TestBed.configureTestingModule({
8-
providers: [<%= classify(name) %>Service]
9-
});
10-
});
6+
beforeEach(() => TestBed.configureTestingModule({}));
117

12-
it('should be created', inject([<%= classify(name) %>Service], (service: <%= classify(name) %>Service) => {
8+
it('should be created', () => {
9+
const service: <%= classify(name) %>Service = TestBed.get(<%= classify(name) %>Service);
1310
expect(service).toBeTruthy();
14-
}));
11+
});
1512
});

0 commit comments

Comments
 (0)