Giter VIP home page Giter VIP logo

Comments (3)

allenhwkim avatar allenhwkim commented on August 21, 2024

Thanks for the reporting. This is fixed with 0.3.2 version

from ngentest.

mtsdesign avatar mtsdesign commented on August 21, 2024

Thanks for the quick response!

from ngentest.

allenhwkim avatar allenhwkim commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.