随笔分类 -  Unit Testing

上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要:For example we have a React comonent: -- A toggle button, we want to test. When it si toggle on, the color is a little bit darken than it's not. Testi 阅读全文
posted @ 2017-09-20 01:59 Zhentiw 阅读(426) 评论(0) 推荐(0)
摘要:For intergration tests, always remember when you create a 'mass' you should aslo clean up the 'mass'. For example when you start the server, you need 阅读全文
posted @ 2017-09-20 01:20 Zhentiw 阅读(216) 评论(0) 推荐(0)
摘要:We have express app: As you can see, we wrap Express App into a function 'startServer' and export it as default export. The return value of this funct 阅读全文
posted @ 2017-09-19 22:33 Zhentiw 阅读(392) 评论(0) 推荐(0)
摘要:directive: test: 阅读全文
posted @ 2017-05-10 02:27 Zhentiw 阅读(387) 评论(0) 推荐(0)
摘要:For example, when testing container component we might import lots of children components, but we didn't actually testing those children components. S 阅读全文
posted @ 2017-05-09 23:54 Zhentiw 阅读(771) 评论(0) 推荐(0)
摘要:The main idea for testing contianer component is to make sure it setup everythings correctlly. Call the onInit() lifecycle first, then the variables h 阅读全文
posted @ 2017-05-09 23:49 Zhentiw 阅读(318) 评论(0) 推荐(0)
摘要:Component: Test: 阅读全文
posted @ 2017-05-09 23:16 Zhentiw 阅读(668) 评论(0) 推荐(0)
摘要:Component: Test @Input & @Output: 阅读全文
posted @ 2017-05-06 03:33 Zhentiw 阅读(313) 评论(0) 推荐(0)
摘要:component: 阅读全文
posted @ 2017-05-03 15:03 Zhentiw 阅读(322) 评论(0) 推荐(0)
摘要:import { Http, Response, ResponseOptions } from '@angular/http'; import { TestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/... 阅读全文
posted @ 2017-05-03 14:50 Zhentiw 阅读(257) 评论(0) 推荐(0)
摘要:import { TestBed, ComponentFixture } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; import { Fil... 阅读全文
posted @ 2017-04-30 22:41 Zhentiw 阅读(230) 评论(0) 推荐(0)
摘要:import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'filesize' }) export class FileSizePipe implements PipeTransform { transform(size: number, extension: string = 'MB') { retu... 阅读全文
posted @ 2017-04-30 15:53 Zhentiw 阅读(273) 评论(0) 推荐(0)
摘要:In this lesson, we will use Chai's request method to test our Node application's API responses.By the end of this lesson, you will know how to:- insta 阅读全文
posted @ 2017-04-29 01:29 Zhentiw 阅读(340) 评论(0) 推荐(0)
摘要:import React from 'react' const Release = React.createClass({ render() { const { title, artist, outOfPrint } = this.props.release; const className = outOfPrint? 'release outOfPri... 阅读全文
posted @ 2017-04-14 22:35 Zhentiw 阅读(267) 评论(0) 推荐(0)
摘要:The problem we face daily when we do testing: The Data structure may changing, component outlook might changing... this makes it hard for us do testin 阅读全文
posted @ 2017-03-28 18:25 Zhentiw 阅读(583) 评论(0) 推荐(0)
摘要:Often when testing, you use the actual result to create your assertion and have to manually update it as you make changes to the feature. With Jest sn 阅读全文
posted @ 2017-02-07 20:27 Zhentiw 阅读(322) 评论(0) 推荐(0)
摘要:Recommend to use angular-cli to generate component and service, so we can get testing templates. Component with injected service: Service: 阅读全文
posted @ 2016-12-20 05:12 Zhentiw 阅读(632) 评论(0) 推荐(0)
摘要:Writing great ES6 style Promises for Node.js is only half the battle. Your great modules must include tests as well to ensure future iterations don't 阅读全文
posted @ 2016-11-11 21:01 Zhentiw 阅读(282) 评论(0) 推荐(0)
摘要:Traditionally you had to create DOM elements to test a directive but by shifting our focus to components, writing unit tests got a lot easier using $c 阅读全文
posted @ 2016-09-08 20:26 Zhentiw 阅读(309) 评论(0) 推荐(0)
摘要:Jest comes pre-packaged with the ability to track code coverage for the modules you're testing, but it takes a little extra work to make it track unte 阅读全文
posted @ 2016-09-08 03:32 Zhentiw 阅读(295) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 下一页