From 6048ec6e0c75f8060a4fe303150b0e31ec958d81 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Wed, 15 Jul 2015 19:09:19 +0200 Subject: [PATCH] Use "mocha" for node tests --- package.json | 3 ++- tests/node-tests.js | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index bb85063..aacce56 100644 --- a/package.json +++ b/package.json @@ -44,12 +44,13 @@ "connect": "^3.3.3", "grunt": "^0.4.5", "grunt-contrib-uglify": "^0.6.0", + "mocha": "^2.2.5", "open": "0.0.5", "serve-static": "^1.7.1" }, "scripts": { "test-browser": "node tests/test.js", - "test-node": "node tests/node-tests.js", + "test-node": "mocha tests/node-tests.js", "test": "npm run test-node && npm run test-browser" } } diff --git a/tests/node-tests.js b/tests/node-tests.js index b6a3041..7a8d3e5 100644 --- a/tests/node-tests.js +++ b/tests/node-tests.js @@ -37,16 +37,19 @@ assert.equal(parsedCsv.errors.length, 0) } - var synchronouslyParsedCsvShouldBeCorrectlyParsed = function() { - assertLongSampleParsedCorrectly(Papa.parse(longSampleRawCsv)); - }(); + describe('PapaParse', function() { + it('synchronously parsed CSV should be correctly parsed', function() { + assertLongSampleParsedCorrectly(Papa.parse(longSampleRawCsv)); + }); - var asynchronouslyParsedCsvShouldBeCorrectlyParsed = function() { - Papa.parse(longSampleRawCsv, { - complete: function(parsedCsv) { - assertLongSampleParsedCorrectly(parsedCsv); - }, + it('asynchronously parsed CSV should be correctly parsed', function(done) { + Papa.parse(longSampleRawCsv, { + complete: function(parsedCsv) { + assertLongSampleParsedCorrectly(parsedCsv); + done(); + }, + }); }); - }(); + }); -})(); \ No newline at end of file +})();