Skip to content

Instantly share code, notes, and snippets.

@roine
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roine/9305257 to your computer and use it in GitHub Desktop.
Save roine/9305257 to your computer and use it in GitHub Desktop.
Quick demo on testing angular provider
describe('Forms module', function () {
var services;
beforeEach(module('app', function(getHtmlProvider){
// set service as the provider to be able to access the setters
services = getHtmlProvider;
}));
// can still test the service by injecting it
it('should return an object', inject(function (getHtml) {
expect(typeof getHtml.get('email.remote')).toBe('object');
}));
// test the service setters
it('should be modifiable', inject(function (getHtml) {
var messages = {
name: {
required: 'hello world'
}
};
services.setMessages(messages);
expect(getHtml.get('name.required').name.required).toBe('hello world');
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment