Loading a mock JSON file within Karma+AngularJS test

前端 未结 8 1555
星月不相逢
星月不相逢 2020-11-28 18:57

I have an AngularJS app set up with tests using Karma+Jasmine. I have a function I want to test that takes a large JSON object, converts it to a format that\'s more consumab

8条回答
  •  孤城傲影
    2020-11-28 19:12

    You can use the karma-html2js-preprocessor to get the json files added to the __html__ global.

    see this answer for details: https://stackoverflow.com/a/22103160/439021

提交回复
热议问题