From cab9a8347a302432e8b01474830c5ea81499ba09 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 17 Aug 2015 21:04:11 -0700 Subject: [PATCH] [Tests] Fixing the tests for node 0.12. --- package.json | 2 +- test/index.js | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b8e1c60..4a6d638 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "main": "index.js", "scripts": { - "test": "npm run lint && node --harmony test/index.js && npm run security", + "test": "npm run lint && node test/index.js && npm run security", "coverage": "covert test/*.js", "coverage-quiet": "covert test/*.js --quiet", "lint": "npm run jscs && npm run eslint", diff --git a/test/index.js b/test/index.js index f40312c..6dbcd81 100644 --- a/test/index.js +++ b/test/index.js @@ -21,12 +21,19 @@ test('makeArrowFunction.list() is an array', function (t) { '() => 42', '() => function () {}', '() => x => x * x', - 'x => x * x' + 'x => x * x', + 'x => { return x * x; }', + '(x, y) => { return x + x; }' ]; + t.plan(1 + 2 * funcs.length); t.equal(Object.prototype.toString.call(funcs), '[object Array]', 'list() is an array'); - for (var i = 0; i < funcs.length; ++i) { - t.equal(typeof funcs[i], 'function', funcs[i] + ' is a function'); - t.equal(String(funcs[i]), expectedSources[i], '"' + funcs[i] + '" !== "' + expectedSources[i] + '"'); + if (funcs.length === 0) { + t.comment('no arrow functions present'); + } else { + for (var i = 0; i < funcs.length; ++i) { + t.equal(typeof funcs[i], 'function', funcs[i] + ' is a function'); + t.equal(String(funcs[i]), expectedSources[i], '"' + funcs[i] + '" !== "' + expectedSources[i] + '"'); + } } t.end(); });