i am doing a test on a js function, and when jasmine enters the function, it returns this:
TypeError: popupAjax is not a function
at buscarAuditoria (file:///C:/Dev/Entorno_Desarrollo/Git/IBERGAUDI/java/sigaudit/WebContent/js/sigaudit/hallazgos/detalleHallazgos.js:358:3)
at UserContext.<anonymous> (file:///C:/Dev/Entorno_Desarrollo/Git/IBERGAUDI/java/sigaudit/WebContent/js/jasmine/spec/detalleHallazgosSpec.js:25:28)
at <Jasmine>
This is the code on my Spec file:
it("prueba para buscar auditoria", function () {
var fakeElement = jasmine.createSpy();
fakeElement.fakeMethod = buscarAuditoria();
spyOn(fakeElement, "fakeMethod");
expect(fakeElement.fakeMethod()).toHaveBeenCalled()
});
And this is the function i am trying to test in js:
function buscarAuditoria() {
if ("" !== hallazgoDto.auditoria.idRegistro && null !== hallazgoDto.auditoria.idRegistro) {
var datos = {};
datos.idAuditoria = hallazgoDto.auditoria.idRegistro;
popupAjax({
selectorPopup : '#popupAuditoria',
urlPopup : $context + '/auditoria/cargaInicialPopup.action',
dataPopup : datos,
title : $i18n['i18n.auditorias.excel.detalleAuditoria'],
resize : false,
width : '60%',
mostrarAceptar : false
});
}
}
Any help will be apreciated, because i am new with jasmine, thanks in advance.