mardi 20 juin 2017

Cannot read property 'MobileServiceClient' of undefined Testing

I am trying to test my component that has a constructor that has injected a service called AzureService

Here is the component snippet:

constructor(private azureService: AzureService) { }

Here is the spec file:

beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        DashbaordComponent,
        StatusComponent
      ],
      providers:[ AzureService]
    }).compileComponents();
  }));

  it('should create the app', async(() => {
    const fixture = TestBed.createComponent(DashbaordComponent);
    const app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));

Here is the service:

export declare var WindowsAzure;
@Injectable()
export class AzureService {
constructor() { this.client = new WindowsAzure.MobileServiceClient(this.azureUrl); }
}

I am unable to understand why it is not important Azure-Apps-Client library that is imported in index.html file:

<script src="//zumo.blob.core.windows.net/sdk/azure-mobile-apps-client.2.0.0.js"></script>

Is there a way i can load this library before i run the test?

Aucun commentaire:

Enregistrer un commentaire