0
我正在通過AngularDart教程工作,並在完成練習時嘗試編寫單元測試。Dart unittest產生無益輸出
我有一個測試,看起來像這樣:
test('should convert sugar ingredient to maple syrup', inject((SugarFilter filter) {
var r1 = new Recipe(null, null, null, ['has sugar in ingredients '], 'bla', null, null);
var r1New = new Recipe(null, null, null, ['has maple syrup in ingredient '], 'bla', null, null);
var r2 = new Recipe(null, null, null,[ 'has pure ingredients'], 'bla', null, null);
var inList = [r1, r2];
var outList = [r1New, r2];
expect(filter(inList), equals(outList));
}));
測試失敗,此輸出:
Test failed: Caught Expected: [Instance of 'Recipe', Instance of 'Recipe']
Actual: [Instance of 'Recipe', Instance of 'Recipe']
Which: was <Instance of 'Recipe'> instead of <Instance of 'Recipe'> at location [0]
我試圖修改爲「categoryFilter」現有的測試,使失敗而且我得到了相同的,相當無益的輸出。
有沒有辦法讓兩個對象的比較輸出更有意義?