이 코드에서 Function.prototype.apply
메서드를 테스트하려면 어떻게해야합니까?sinon이있는 자바 스크립트 적용 테스트
var yoGen = require('yeoman-generator');
exports.method = function() {
yoBen.Base.apply(this, arguments);
};
올바른 모듈에서 올바른 인수를 사용하여 해당 적용이 호출되었다고 어떻게 주장 할 수 있습니까? 나는이 같은 시도하지만 실패 : 어설의
var apply = sinon.stub(yoGen.Base,'apply');
testingModule.method();
sinon.assert.calledWith(apply,testingModule,{});
오류 :
apply({ ... content of testingModule ... }) != { ... content of testingModule ... }
할 일은 무엇입니까? 뭔가를 반환하는 함수입니까? – staypuftman
@staypuftman 질문을 업데이트했습니다 ... 함수를 btw ... – urosjarc