Comments (3)
Thanks for the reporting. This is fixed with 0.3.2 version
from ngentest.
Thanks for the quick response!
from ngentest.
Closing this. Now it's 0.3.3 with more robust code generation. For example,
// tslint:disable
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Injectable, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
import { By } from '@angular/platform-browser';
import { Observagle } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/throw';
import {Component, Directive, Inject, PLATFORM_ID} from '@angular/core';
import {AppComponent} from './my.component';
import {AuthGuardService} from './common/app-common.module';
import {CookieService} from './common/services/cookie.service';
import {AppLoadService} from './framework/app-load.service';
import {AgentHeaderDataService} from './common/services/agent-header-data.service';
import {Router} from '@angular/router';
import {CommonUtilsService} from './common/services/common-utils.service';
import {DeeplinkService} from './common/services/deeplink.service';
@Injectable()
class MockAuthGuardService { }
@Injectable()
class MockCookieService { }
@Injectable()
class MockAppLoadService { }
@Injectable()
class MockAgentHeaderDataService { }
@Injectable();
class MockRouter { navigate = jest.fn(); }
@Injectable()
class MockCommonUtilsService { }
@Injectable()
class MockDeeplinkService { }
describe('AppComponent', () => {
let fixture;
let component;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
providers: [
{provide: AuthGuardService, useClass: MockAuthGuardService},
{provide: CookieService, useClass: MockCookieService},
{provide: AppLoadService, useClass: MockAppLoadService},
{provide: AgentHeaderDataService, useClass: MockAgentHeaderDataService},
{provide: PLATFORM_ID,useValue: 'browser'},
{provide: Router, useClass: MockRouter},
{provide: CommonUtilsService, useClass: MockCommonUtilsService},
{provide: DeeplinkService, useClass: MockDeeplinkService},
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
}).compileComponents();
fixture = TestBed.createComponent(AppComponent);
component = fixture.debugElement.componentInstance;
});
it('should create a component', async () => {
expect(component).toBeTruthy();
});
...
from ngentest.
Related Issues (20)
- angular 5 HOT 2
- does not work with nrwl nx HOT 1
- Type error on get command help HOT 1
- In my case it failer because the model. HOT 4
- Error generating for require-from-string HOT 7
- Error generating for close method HOT 2
- cannot find module using alias HOT 5
- Explain how to deal with paths and modules HOT 2
- Invalid typescript file - have tried the solutions in the closed issue HOT 8
- if components refer to class definitions : ngentest fails
- Getting error when trying to generate unit test HOT 15
- No Support for Arrow Functions? HOT 3
- ReferenceError: HTMLElement is not defined HOT 1
- Add support of Angular 15 HOT 1
- Plugin is not working with NX15 HOT 1
- Invalid typescript file error with latest ngentest version in angular 15 HOT 7
- Bugs on new versions HOT 1
- Framework Options not supported if we use the package directly in our code HOT 1
- Cannot find module '•/ejs-templates/class.template.js' HOT 1
- [QUESTION] How to mock properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngentest.