Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 23, 2019
1 parent 988b924 commit c9e8e09
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "echo \"Error: no test specified\" && exit 1",
"tests-only": "node test",
"test": "npm run tests-only",
"posttest": "npx aud"
},
"repository": {
Expand All @@ -29,6 +30,7 @@
"homepage": "https://github.com/ljharb/functions-have-names#readme",
"devDependencies": {
"@ljharb/eslint-config": "^13.1.1",
"eslint": "^5.16.0"
"eslint": "^5.16.0",
"tape": "^4.11.0"
}
}
14 changes: 14 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

var test = require('tape');

var hasNames = require('../');

test('named functions', function (t) {
function f() {}
var g = function h() {};

t.equal(hasNames(), f.name === 'f' && g.name === 'h', 'functions have names or not as expected');

t.end();
});

0 comments on commit c9e8e09

Please sign in to comment.