componentSpec.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. describe('author.component-name', function () {
  2. beforeEach(module('author.component-name'));
  3. it('should have thingService', function () {
  4. inject(function (thingService) {
  5. expect(thingService).toBeDefined();
  6. });
  7. });
  8. describe('thingService', function () {
  9. var thingService;
  10. beforeEach(inject(function (_thingService_) {
  11. thingService = _thingService_;
  12. }));
  13. it('should be an object', function () {
  14. expect(typeof thingService).toBe('object');
  15. });
  16. it('should have a method sayHello()', function () {
  17. expect(thingService.sayHello).toBeDefined();
  18. });
  19. describe('sayHello()', function () {
  20. it('should be a function', function () {
  21. expect(typeof thingService.sayHello).toBe('function');
  22. });
  23. it('should return a string', function () {
  24. expect(typeof thingService.sayHello()).toBe('string');
  25. });
  26. it('should return \'Hello!\'', function () {
  27. expect(thingService.sayHello()).toEqual('Hello!');
  28. });
  29. });
  30. });
  31. });