I am trying to load json from local folder and then feed it into function to test it. Here is what I am trying to do:
it('should be able to use treatExpResultJSON() function to treat incoming JSON', function() {
require(['./jsonSampleData.json'], function(json){
expect(dirService.treatExpResultJSON(json)).not.toBeNull();
expect(dirService.treatExpResultJSON(json)).not.toBeUndefined();
console.log(json);
console.log("Testing json passed!");
});
});
expect is not working inside the require callback function, I guess, it is not called at all since with both .not.toBeNull(), not.toBeUndefined() and .toBeNull(), toBeUndefined() the test is showing success. Also, console.log() are not working inside the function. So, how should I actually load the json, then supply it to the function?