I am just setting up tests for my angular2 meteor app but I am really struggling to get off the ground. I am currently using meteortesting:mocha
but when I run TEST_WATCH=1 meteor test --driver-package meteortesting:mocha
and navigate to http://localhost:3000/
The browser console gives me the error:
Uncaught ReferenceError: Zone is not defined
This is the only test file I have, which is causing the issue:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { MenuAdminPage } from './menuadmin';
import { Factory } from 'meteor/dburles:factory';
import { assert } from 'chai';
describe('MenuAdminPage (templateUrl)', () => {
let comp: MenuAdminPage;
let fixture: ComponentFixture<MenuAdminPage>;
let de: DebugElement;
let el: HTMLElement;
// async beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MenuAdminPage ], // declare the test component
})
.compileComponents(); // compile template and css
}));
// synchronous beforeEach
beforeEach(() => {
fixture = TestBed.createComponent(MenuAdminPage);
comp = fixture.componentInstance; // MenuAdminPage test instance
// query for the title <h1> by CSS element selector
de = fixture.debugElement.query(By.css('h1'));
el = de.nativeElement;
});
it('no title in the DOM until manually call `detectChanges`', () => {
expect(el.textContent).toEqual('');
});
it('should display original title', () => {
fixture.detectChanges();
expect(el.textContent).toContain(comp.title);
});
it('should display a different test title', () => {
comp.title = 'Test Title';
fixture.detectChanges();
expect(el.textContent).toContain('Test Title');
});
});
I am using meteor 1.6
Aucun commentaire:
Enregistrer un commentaire