7
AngularJS 서비스에 모의 객체 삽입
AngularJS 서비스가 작성되었으며 단위 테스트를 원합니다. angular.module('myServiceProvider', ['fooServiceProvider', 'barServiceProvider']). factory('myService', function ($http, fooService, barService) { this.something = function() { // Do something with the injected services }; return this; }); 내 app.js 파일에는 다음이 등록되어 있습니다. angular .module('myApp', ['fooServiceProvider','barServiceProvider','myServiceProvider'] ) DI가 다음과 같이 작동하는지 테스트 할 수 있습니다. describe("Using the …