Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { async, TestBed } from '@angular/core/testing';
- import { MatListModule, MatSidenavModule } from '@angular/material';
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
- import { RouterTestingModule } from '@angular/router/testing';
- import { ApolloModule } from 'apollo-angular';
- import { ApolloTestingModule } from 'apollo-angular/testing';
- import { ApolloClient, ApolloClientOptions } from 'apollo-client';
- import { AppComponent } from './app.component';
- // Copy a GQL response (that includes __typename etc)
- const gqlResponse = `
- {
- "data": {
- "comments": []
- }
- }`;
- function provideClient(): any {
- return new ApolloClient({
- networkInterface: {
- query: function () {
- return new Promise(resolve => resolve(gqlResponse));
- }
- }
- });
- }
- describe('AppComponent', () => {
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [AppComponent],
- imports: [
- ApolloTestingModule,
- MatListModule,
- MatSidenavModule,
- RouterTestingModule,
- BrowserAnimationsModule,
- ApolloModule.withClient(provideClient)
- // Failed: apollo_angular_1.ApolloModule.withClient is not a function
- ]
- }).compileComponents();
- }));
- it('should make a srv req', async(() => {
- }));
- it('should create the app', async(() => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.debugElement.componentInstance;
- expect(app).toBeTruthy();
- }));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement