Skip to content

Commit 1b721a8

Browse files
committed
chore(test): split single test into multiple tests
1 parent 8ef07ef commit 1b721a8

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

test/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,29 @@
22
var assert = require('simple-assert');
33
var getFuncName = require('..');
44
describe('getFuncName', function () {
5-
it('getFuncName', function () {
6-
// Asserting that `getFuncName` behaves correctly
5+
it('should get the function name', function () {
6+
function normalFunction() {
7+
return 1;
8+
}
9+
10+
assert(getFuncName(normalFunction) === 'normalFunction');
11+
});
12+
13+
it('should get correct name when function is surrounded by comments', function () {
714
function /*one*/correctName/*two*/() { // eslint-disable-line no-inline-comments, spaced-comment
815
return 0;
916
}
10-
function withoutComments() {
11-
return 1;
12-
}
1317

18+
assert(getFuncName(correctName) === 'correctName');
19+
});
20+
21+
it('should return empty string for anonymous functions', function () {
1422
var anonymousFunc = (function () {
1523
return function () { // eslint-disable-line func-style
1624
return 2;
1725
};
1826
}());
19-
assert(getFuncName(correctName) === 'correctName');
20-
assert(getFuncName(withoutComments) === 'withoutComments');
2127
assert(getFuncName(anonymousFunc) === '');
2228
});
2329
});
30+

0 commit comments

Comments
 (0)