2019-03-22 05:42:52 -04:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2019-03-22 05:42:52 -04:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
|
|
|
// #docregion angular-setup
|
|
|
|
import {TestBed} from '@angular/core/testing';
|
|
|
|
import {createAngularJSTestingModule, createAngularTestingModule} from '@angular/upgrade/static/testing';
|
|
|
|
|
2020-04-13 19:40:21 -04:00
|
|
|
import {HeroesService, ng1AppModule, Ng2AppModule} from './module';
|
2019-03-22 05:42:52 -04:00
|
|
|
|
|
|
|
const {module, inject} = (window as any).angular.mock;
|
|
|
|
|
|
|
|
// #enddocregion angular-setup
|
|
|
|
describe('HeroesService (from Angular)', () => {
|
|
|
|
// #docregion angular-setup
|
|
|
|
beforeEach(() => {
|
|
|
|
TestBed.configureTestingModule(
|
|
|
|
{imports: [createAngularTestingModule([ng1AppModule.name]), Ng2AppModule]});
|
|
|
|
});
|
|
|
|
// #enddocregion angular-setup
|
|
|
|
|
|
|
|
// #docregion angular-spec
|
|
|
|
it('should have access to the HeroesService', () => {
|
2019-08-28 19:22:36 -04:00
|
|
|
const heroesService = TestBed.inject(HeroesService);
|
2019-03-22 05:42:52 -04:00
|
|
|
expect(heroesService).toBeDefined();
|
|
|
|
});
|
|
|
|
// #enddocregion angular-spec
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('HeroesService (from AngularJS)', () => {
|
|
|
|
// #docregion angularjs-setup
|
|
|
|
beforeEach(module(createAngularJSTestingModule([Ng2AppModule])));
|
|
|
|
beforeEach(module(ng1AppModule.name));
|
|
|
|
// #enddocregion angularjs-setup
|
|
|
|
|
|
|
|
// #docregion angularjs-spec
|
2020-04-13 19:40:21 -04:00
|
|
|
it('should have access to the HeroesService', inject((heroesService: HeroesService) => {
|
|
|
|
expect(heroesService).toBeDefined();
|
|
|
|
}));
|
2019-03-22 05:42:52 -04:00
|
|
|
// #enddocregion angularjs-spec
|
|
|
|
});
|