First, you need to load the external javascript file into the Karma validator by adding files
config to karma.config.js
, as shown below:
files: [
'https://connect.facebook.net/en_US/sdk.js'
],
crossOriginAttribute: false,
And then make sure your test is NOT IN async
.
, , :
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
async
, :
it('should create the app', (() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
, .