Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load external Json file using karma+Jasmine for angularJS testing?/

Can anyone provide me an example in PLUNKER that how to load JSON file for karma/jasmine test.I want to read the data from JSON file for the test cases i am writing.I have been searching but nowhere they mentioned clear example on how to do it? I appreciate it if anyone can provide with the example.

like image 984
user2573410 Avatar asked Feb 25 '14 02:02

user2573410


1 Answers

You can load an external json data file using require

var data = require('./data.json');
console.log(data);
// Your test cases goes here and you can use data object
like image 158
Pradeep Lakku Avatar answered Oct 18 '22 09:10

Pradeep Lakku