Matteo Scandolo | c49f53c | 2016-04-20 11:38:42 -0700 | [diff] [blame] | 1 | /** |
| 2 | * © OpenCORD |
| 3 | * |
| 4 | * Created by teone on 4/18/16. |
| 5 | */ |
| 6 | |
| 7 | // TODO write tests for log |
| 8 | |
| 9 | (function () { |
| 10 | 'use strict'; |
| 11 | |
| 12 | xdescribe('The xos.helper module', function(){ |
| 13 | |
| 14 | let log; |
| 15 | |
| 16 | // beforeEach(module('xos.helpers')); |
| 17 | |
| 18 | var mockLog; |
| 19 | |
| 20 | beforeEach(function() { |
| 21 | mockLog = jasmine.createSpyObj('logMock', ['info']); |
| 22 | }); |
| 23 | |
| 24 | beforeEach(function() { |
| 25 | angular.mock.module('xos.helpers', function($injector, $provide) { |
| 26 | $provide.value('$log', mockLog); |
| 27 | $provide.decorator('$log', $injector.get('logDecorator')); |
| 28 | }); |
| 29 | }); |
| 30 | |
| 31 | // beforeEach(inject(($log) => { |
| 32 | // log = $log; |
| 33 | // log.reset(); |
| 34 | // })); |
| 35 | |
| 36 | describe('The log decorator', () => { |
| 37 | it('should not print anything', inject(($log) => { |
| 38 | // spyOn(log, 'info'); |
| 39 | $log.info('test'); |
| 40 | // expect(mockLog.info).not.toHaveBeenCalled(); |
| 41 | })); |
| 42 | |
| 43 | xdescribe('if logging is enabled', () => { |
| 44 | beforeEach(() => { |
| 45 | window.location.href += '?debug=true' |
| 46 | }); |
| 47 | |
| 48 | it('should should log', () => { |
| 49 | log.info('test'); |
| 50 | console.log(log.info.logs); |
| 51 | }); |
| 52 | }); |
| 53 | }); |
| 54 | }); |
| 55 | })(); |