blob: 21085c6b8a2ecabda37778142cfc633d2b1caf03 [file] [log] [blame]
Matteo Scandoloa5d03d52016-07-21 11:35:46 -07001/**
2 * © OpenCORD
3 *
4 * Created by teone on 4/18/16.
5 */
6/* eslint-disable angular/ng_window_service*/
7
8// TODO write tests for log
9// NODE Actually the code is working, the tests are not.
10
11(function () {
12 'use strict';
13
14 xdescribe('The xos.helper module', function(){
15
16 let log, window;
17
18 let 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 // console.log('$injector',$injector.get('logDecorator'));
27 $provide.value('$log', mockLog);
28 // $provide.decorator('$log', $injector.get('logDecorator'));
29 });
30 });
31
32 beforeEach(inject(($log, $window) => {
33 log = $log;
34 window = $window;
35 // log.reset();
36 }));
37
38 describe('The log decorator', () => {
39 it('should not print anything', inject(($log) => {
40 // spyOn(log, 'info');
41 $log.info('test');
42 expect(mockLog.info).not.toHaveBeenCalled();
43 }));
44
45 });
46 describe('if logging is enabled', () => {
47 beforeEach(() => {
48 window.location.href += '?debug=true'
49 });
50
51 it('should should log', () => {
52 log.info('test');
53 console.log(log.info.logs);
54 });
55 });
56 });
57})();