Hey everyone, I need some help with a JavaScript issue. So, I have a file named FileA.js which contains a prototype called FileAObject.prototype along with a function named funcAlpha(). Here's a snippet of what it looks like:
File = FileA
function someFunction() {
SomeFunctionality...
}
function FileAObject() {
Object definition
}
FileAObject.prototype.funcAlpha = function() {
...
}
My goal is to spy on the funcAlpha() function. Typically, I would set up a mock like this:
var FILE_A = $.import('path.to.file.directory', 'FileA');
<rest of code here>
spyOn(FILE_A, 'funcAlpha').andCallFake(function() {
return fakeResult;
}
<complete test>
However, when I try running my test, it doesn't work because funcAlpha is an attribute of FileAObject and not directly FileA itself. This is where I'm stuck. I'm new to JavaScript and finding these problems quite confusing. Any advice or guidance would be much appreciated!