Last active
August 29, 2015 13:56
-
-
Save roine/9305257 to your computer and use it in GitHub Desktop.
Quick demo on testing angular provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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