0
我是JavaScript的新手。我正在通過Jasmine的測試瞭解Class。我試圖清除測試,但儘管我的努力,茉莉花不顯示綠色。簡單類測試不通過
我的代碼如下:
// Generated by CoffeeScript 1.3.3
var Animal;
Animal = (function() {
function Animal() {}
Animal.prototype.walk = function() {
return 'tok tok...';
};
return Animal;
})();
而且測試代碼如下:
// Generated by CoffeeScript 1.3.3
describe("Animal", function() {
var animal;
animal = new Animal;
it("shold walk", function() {
expect(animal.walk).toBe('tok tok...');
});
});
而且從茉莉花消息如下:
Expected Function to be 'tok tok...'.
Error: Expected Function to be 'tok tok...'.
at new jasmine.ExpectationResult (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:102:32)
at null.toBe (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1194:29)
at null.<anonymous> (http://localhost:8888/__spec__/AnimalSpec.js:8:25)
at jasmine.Block.execute (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:1024:15)
at jasmine.Queue.next_ (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2025:31)
at goAgain (http://localhost:8888/__JASMINE_ROOT__/jasmine.js:2015:18)
我累死。謝謝您的好意...