Thursday, 4 October 2018

Basic create component test failing with MoJs

I have a component that is using the animation library Mojs. The create component test that comes out of the box with the spec.ts file is failing because of MoJs elements. I am not sure how to provide this library in the spec.ts file so that at the least this test for the component successfully creating passes.

The error I am getting is: 'Cannot read property 'CustomShape' of undefined'

the implementation of this CustomShape looks like:

    class paperOutlineTopCorner3 extends mojs.CustomShape {
     getShape () { return '<path d="123XYZ"/>'; }
    }

my current spec.ts file:

import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { CallbackComponent } from './callback.component';
import { requiredTestModules } from '../testing/import.helpers';

describe('CallbackComponent', () => {
 let component: CallbackComponent;
 let fixture: ComponentFixture<CallbackComponent>;

beforeEach(async(() => {
 TestBed.configureTestingModule({
  declarations: [ CallbackComponent ],
  imports: [requiredTestModules]
})
.compileComponents();
}));

beforeEach(() => {
 fixture = TestBed.createComponent(CallbackComponent);
 component = fixture.componentInstance;
 fixture.detectChanges();
});

it('should create', () => {
 expect(component).toBeTruthy();
});
});

any help/suggestions would be much appreciated



from Basic create component test failing with MoJs

No comments:

Post a Comment