本文整理汇总了TypeScript中angular2/testing.expect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript expect函数的具体用法?TypeScript expect怎么用?TypeScript expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
subscription = observable.subscribe(val => {
expect(val).toBe(null);
done();
});
示例2: expect
.then((rootTC: any) => {
let aboutDOMEl = rootTC.debugElement.children[0].nativeElement;
expect(DOM.querySelectorAll(aboutDOMEl, 'h2')[0].textContent).toEqual('Features');
});
示例3: it
it('validates email', () => {
const validEmail = new Control('test@test.com');
const invalidEmail = new Control('test');
expect(Validators.email(validEmail)).toBeUndefined();
expect(Validators.email(invalidEmail)).toEqual({email: false});
});
示例4: it
it('should have id as assigned',() => {
expect(employee.id).toEqual(1);
});
示例5: it
it('should call API to get collection of a known model', () => {
apiService.getCollection('person');
expect(apiService.getCollectionByUrl).toHaveBeenCalled();
expect(apiService.getCollectionByUrl).toHaveBeenCalledWith('http://localhost:8000/people');
});
示例6: it
it('should get the meaning of life', inject([ReduxTwoApp], (app: ReduxTwoApp) => {
expect(app.meaningOfLife()).toBe('The meaning of life is 42');
expect(app.meaningOfLife(22)).toBe('The meaning of life is 22');
}));
示例7: expect
return tcb.createAsync(UserListItemComponent).then((fixture: ComponentFixture) => {
fixture.componentInstance.id = 15;
fixture.componentInstance.viewDetails();
expect(mockRouter.navigate).toHaveBeenCalledWith(['/UserDetail', {userId: 15}]);
});
示例8: expect
return tcb.createAsync(AppComponent).then(fixture => {
expect(fixture.componentInstance instanceof AppComponent).toBe(true, 'should create AppComponent');
});
示例9: it
it('is created', inject([SocketService], service => {
expect(service).toBeDefined();
}));
示例10: it
it('should provide default id', inject([APP_ID], (id) => {
expect(id).toBe('a');
}));