2016-09-08 5 views
0

私はproject.Whenでのテストフレームワークとしてのモカを使用しています私はユニットテストを書き、私がすることを好む:いいですか、それとも接続していませんか?

describe('cooperation',() => { 
    describe('create cooperation', done => { 
    it('should create a cooperation between A and B', done => { 
     //make a post request to create a cooperation between A and B 
     //res.body.should.deepEqual({/*cooperation object*/}) 
     done(); 
    }); 
    }); 

    describe('get cooperation', done => { 
    before(done => { 
     //clear any cooperation in database 
     //initital cooperation between A and B by fixture tool 
     done(); 
    }); 

    it('get A's partner', done => { 
     //make a get request to get cooperation of A 
     //res.body should have B 
    }); 
    }); 
}); 

しかし、私の同僚はに好む:

describe('cooperation',() => { 
    it('should create a cooperation between A and b', done => { 
    //make a post request to create a cooperation between A and B 
    //res.body.should.deepEqual({/*cooperation object*/}) 
    done(); 
    }); 

    it('get A's partner', done => { 
    //make a get request to get cooperation of A 
    //res.body should have B 
    }); 
}); 

は私が優れているかを知りたいですなぜ?

答えて

1

私はあなたのチームメイトと一緒に行きます。私の意見では、あなたのスタイルは不必要な膨らみを持ち、他のスタイルに比べて読みやすさが悪いです。私は自分のアプローチで、他のものよりも優れたものを達成しようとしているものは何を期待しているのでしょうか?

テストをシンプルで清潔に保つ。

関連する問題