File tree Expand file tree Collapse file tree 7 files changed +3457
-0
lines changed Expand file tree Collapse file tree 7 files changed +3457
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ node_modules /
Original file line number Diff line number Diff line change 1+ # TDD Dojo 环境预检查 - JS 版
2+
3+ 请完成本代码库的运行并修复失败的测试。
4+
5+ ## 环境要求
6+
7+ 必须:
8+
9+ - NodeJS 12 以上版本
10+ - Yarn
11+
12+ 推荐:
13+
14+ - WebStorm 或者 Visual Studio Code 最新版
15+
16+ ## 运行方式
17+
18+ - 安装依赖 ` yarn `
19+ - 运行测试 ` yarn test `
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ presets : [
3+ [
4+ '@babel/preset-env' ,
5+ {
6+ targets : {
7+ node : 'current' ,
8+ } ,
9+ } ,
10+ ] ,
11+ ] ,
12+ } ;
13+
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " dojo" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " TDD dojo by extremeprogramming.cn" ,
5+ "main" : " src/index.js" ,
6+ "author" : " Kimmy" ,
7+ "license" : " MIT" ,
8+ "scripts" : {
9+ "test" : " jest"
10+ },
11+ "devDependencies" : {
12+ "@babel/core" : " ^7.7.5" ,
13+ "@babel/preset-env" : " ^7.7.6" ,
14+ "babel-jest" : " ^24.9.0" ,
15+ "jest" : " ^24.9.0"
16+ }
17+ }
Original file line number Diff line number Diff line change 1+
2+ export default class Calculator {
3+ add ( x , y ) {
4+ return 0 ;
5+ }
6+ }
Original file line number Diff line number Diff line change 1+
2+ import Calculator from "./Calculator"
3+
4+ describe ( "Calculator" , ( ) => {
5+ it ( "should equal to 2 when add 1 and 1" , ( ) => {
6+ const calculator = new Calculator ( )
7+
8+ const result = calculator . add ( 1 , 1 )
9+
10+ expect ( result ) . toBe ( 2 )
11+ } )
12+ } ) ;
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments