Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore(test): split single test into multiple tests
  • Loading branch information
vieiralucas committed Oct 15, 2016
1 parent 8ef07ef commit 1b721a8
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/index.js
Expand Up @@ -2,22 +2,29 @@
var assert = require('simple-assert');
var getFuncName = require('..');
describe('getFuncName', function () {
it('getFuncName', function () {
// Asserting that `getFuncName` behaves correctly
it('should get the function name', function () {
function normalFunction() {
return 1;
}

assert(getFuncName(normalFunction) === 'normalFunction');
});

it('should get correct name when function is surrounded by comments', function () {
function /*one*/correctName/*two*/() { // eslint-disable-line no-inline-comments, spaced-comment
return 0;
}
function withoutComments() {
return 1;
}

assert(getFuncName(correctName) === 'correctName');
});

it('should return empty string for anonymous functions', function () {
var anonymousFunc = (function () {
return function () { // eslint-disable-line func-style
return 2;
};
}());
assert(getFuncName(correctName) === 'correctName');
assert(getFuncName(withoutComments) === 'withoutComments');
assert(getFuncName(anonymousFunc) === '');
});
});

0 comments on commit 1b721a8

Please sign in to comment.