Angular-Jasmine, Loading Json
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 tre
Solution 1:
Try this:
json = require('./jsonSampleData.json');
it('should be able to use treatExpResultJSON() function to treat incoming JSON', function() {
expect(dirService.treatExpResultJSON(json)).not.toBeNull();
expect(dirService.treatExpResultJSON(json)).not.toBeUndefined();
console.log(json);
console.log("Testing json passed!");
});
I use this structure in my tests, and works.
Post a Comment for "Angular-Jasmine, Loading Json"