|
- const expect = require('chai').expect
- var debug = require('debug');
-
- describe('Tests for app/logging module', function(){
- beforeEach(function(){
- var debugcb = this.sandbox.spy();
- debugcb.namespace = "";
- debugcb.enabled = true;
-
- //console.log(require.cache[require.resolve('debug')]);
-
- this.debugcb = debugcb;
- this.debug = this.sandbox.stub(require.cache[require.resolve('debug')], 'exports').callsFake(function(ns){
- debugcb.namespace = ns;
- return debugcb;
- });
- });
-
-
- /*it('Create Log instance', function(){
- let log = new (require('../app/logging')).Log("test");
- expect(this.debug.called).to.eql(true);
- });*/
-
- it('Test info()', function(){
- let log = new (require('../app/logging')).Log("test");
- let msg = "Test Burger";
- log.info(msg);
-
- console.log(log.__d === this.debugcb);
- console.log(log.__d);
- console.log(this.debugcb);
- var cb2 = this.debugcb;
- cb2.namespace = 'dummy';
- console.log(this.debugcb);
- console.log(cb2);
- console.log(log.__d);
- expect(this.debugcb.called).to.eq(true);
- //expect(this.debugcb.calledWith("[ INFO ]: " + msg)).to.eql(true);
- });
- });
|