-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
traceAspect coverage to 100% -useless but fun
- Loading branch information
1 parent
5b98d2d
commit bdad165
Showing
3 changed files
with
70 additions
and
33 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** @license MIT License (c) Copyright (c) 2014 Julio Makdisse Saito */ | ||
|
||
/** | ||
* Mogger | ||
* Meld + Trace + Colorful logger | ||
* | ||
* Licensed under the MIT License at: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* | ||
* @author Julio Makdisse Saito (saitodisse@gmail.com) | ||
* @version 0.5.0 | ||
*/ | ||
|
||
|
||
var assert = require('assert'); | ||
var sinon = require('sinon'); | ||
var _ = require('lodash'); | ||
var traceAspect = require('../src/trace-aspect'); | ||
|
||
describe('Trace Aspect (meld)', function (){ | ||
|
||
var onCallSpy, onReturnSpy, onThrowSpy, traceAspectFunction; | ||
beforeEach(function () { | ||
var jp = function() { | ||
return { | ||
method: '', | ||
target: '', | ||
args: [] | ||
}; | ||
}; | ||
|
||
onCallSpy = sinon.spy(); | ||
onReturnSpy = sinon.spy(); | ||
onThrowSpy = sinon.spy(); | ||
var reportSpy = { | ||
onCall: onCallSpy, | ||
onReturn: onReturnSpy, | ||
onThrow: onThrowSpy, | ||
}; | ||
|
||
traceAspectFunction = traceAspect(reportSpy, jp); | ||
}); | ||
|
||
it('no jointpoint', function() { | ||
traceAspectFunction = traceAspect(null); | ||
assert.equal(true, _.isObject(traceAspectFunction)); | ||
}); | ||
|
||
it('before', function() { | ||
traceAspectFunction.before(); | ||
assert.equal(true, onCallSpy.called); | ||
}); | ||
|
||
it('afterReturning', function() { | ||
traceAspectFunction.afterReturning({result: null}); | ||
assert.equal(true, onReturnSpy.called); | ||
}); | ||
|
||
it('afterThrowing', function() { | ||
traceAspectFunction.afterThrowing({exception: null}); | ||
assert.equal(true, onThrowSpy.called); | ||
}); | ||
|
||
|
||
}); |