Skip to content

Commit

Permalink
testing injector
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Sep 1, 2015
1 parent dd48bcc commit f5b10f3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion spec/factory-example-spec.js
Expand Up @@ -26,8 +26,21 @@ ngDice({
it('returns function with name bar', function () {
var fn = getBar();
la(check.fn(fn), 'returns a function', fn);
console.log('returned function', fn.toString());
la(fn.name === 'bar');
});

it('has the factory', function () {
var injector = angular.injector(['FactoryExample']);
la(injector.has('factory-example'), 'injector has factory-example');
});

it('can grab the factory', function () {
var injector = angular.injector(['FactoryExample']);
var f = injector.get('factory-example');
la(check.object(f), 'factory is a object');
la(check.fn(f.foo), 'has foo method');
var result = f.foo();
la(result === 'bar', 'returns "bar"', result);
});
}
});

0 comments on commit f5b10f3

Please sign in to comment.