2
그래서, 나는 각도 테스트와 그립에 도달하려고 노력하고있어, 나는 조금 붙어있어 ... 내가 읽은 것 (또는 내가 무엇을 이해했는지 나는 아래 작동합니다) 읽었습니다,하지만 난 다음 오류 받고 있어요 :각도, 카르마 의존성 주입, 주사 실패
오류 : [NG : AREQ] 인수 'FN'는 함수가 아닙니다을, 객체 가지고 http://errors.angularjs.org/1.2.26/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20Object
app = angular.module("MyApp", ["ngMock"])
myService = null
angular.module("MyApp").factory "myDependency",() ->
getSomething: ->
"awesome"
angular.module("MyApp").factory "myService", (myDependency) ->
useDependency: ->
myDependency.getSomething()
describe "myService", ->
beforeEach ->
module "MyApp", ($provide) ->
mockDependency =
getSomething: ->
"mockReturnValue"
console.log "providing"
$provide.value("myDependency", mockDependency)
inject (_myService_) ->
console.log "injecting"
myService = _myService_
it "is there", ->
expect(myService).not.toBeNull()
expect(myService.useDependency()).toEq("mockReturnValue")
또한 "제공자"가 로그에 표시되지만 "주사"는 표시되지 않습니다.