我有这个帖子请求将代码模拟到beforeEach函数
$httpBackend.when('POST', CONFIG.get('MAIN_URL_FOR_REST_SERVICES') + 'actions/search').respond(200,
'[{"name": "all","id": "1"}]'
);
如何将httpBackend响应存储到json文件中?
[{"name": "all","id": "1"}]
存储到actions.json
谢谢!
答案 0 :(得分:0)
答案是:
jasmine.getJSONFixtures().fixturesPath = 'base/test/unit/authz/api_mock/';
$httpBackend.when('POST', CONFIG.get('MAIN_URL_FOR_REST_SERVICES') + 'actions/search').respond(function() {
return [200, window.getJSONFixture('actions.json')];
});