我有一个本地的一个js文件的函数,但导出用于使其全局。当我试图在规范中实例化它时,jasmine抛出一个错误,说明函数没有定义。
RoomReservation功能:
RoomReservation = (function() {
RoomReservation.prototype.searchRatePlans = function(search, callback, filter) {
....
};
return RoomReservation;
})();
exports.RoomReservation = RoomReservation;
Jasmine Spec:
it('To test RoomReservation function',function(){
var filter='groupCode';
var search='g';
spyOn(RoomReservation.prototype, 'searchRatePlans');
var k = new RoomReservation();
expect(k.searchRatePlans).toHaveBeenCalled();
});