jeudi 11 août 2016

Tests fail after Angular 2 RC5

I had used the following format for my tests:

export function main() {
    describe('Angular2 component test', function() {
         it('should initialize component',
           async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
              var template = '<specific-component-tag>';
                return tcb.overrideTemplate(TestComponent, template)
                .createAsync(TestComponent)
                .then((fixture) => {
                    expect(fixture.componentInstance.viewChild).toBeDefined();
                    fixture.detectChanges();
                    expect(fixture.componentInstance.viewChild.items.length).toBe(1);
                    // .... etc.
                }).catch (reason => {
                    console.log(reason);
                    return Promise.reject(reason);
                });
         })));
      });
}
This work fine in RC4. But RC5 came suddenly and now this code have not worked. It throws me the following errors:
Module ".... @angular/core/testing" has no exported member 'it'.
Module ".... @angular/core/testing" has no exported member 'describe'.
Module ".... @angular/core/testing" has no exported member 'expect'.
Module ".... @angular/core/testing" has no exported member 'beforeEachProviders'.
Module ".... @angular/compiler/testing" has no exported member 'TestComponentBuilder'.
Module ".... @angular/compiler/testing" has no exported member 'ComponentFixture'.

Please help me to migrate this test to angular2 RC5.

Aucun commentaire:

Enregistrer un commentaire