AngularJS testing a service with dependencies -


il go strait it. im writing unit tests angular front end application. have far... app.js:

var app = angular.module('app', ['dependency1', 'dependency2', 'dependency3']); 

then create service have:

app.factory('myservice', ['servicedependency', function(servicedependency) {     ... }); 

how create/inject myservice tested? when do:

beforeeach(module("app")); 

jasmine screams @ me not finding dependencies, , dont know how mock them. (there more 3, way more. :) )

beforeeach(inject(function(myservice){})); 

does not work without doing 'module' 1 first. im stuck on 3 days googleing watching videos , cant find need, or cant see it. first time writing help, ask questions if feel missed something, , need more info.

ktnxbye 

edit:

custom providers created so:

app.config(['customprovider', function(customprovider){ ... }]); 

any suggestions on how mock this?

ktnxbye 

well, i've 'solved' it! did included dependencies required app in test project , runs fine. don't quite solution. more if how mock dependencies. still try mock them , if i'm successful post here see. appreciate :)

ktnxbye 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -