added necessary npm packages

This commit is contained in:
Aqeeb Imtiaz Harun
2018-08-09 11:15:09 +08:00
parent 93ee4ecb68
commit fc1b011160
2787 changed files with 243227 additions and 1 deletions
+32
View File
@@ -0,0 +1,32 @@
var Code = require('code'),
Lab = require('lab'),
lab = Lab.script(),
jph = require('..'); // 'json-parse-helpfulerror'
exports.lab = lab;
lab.test('can parse', function (done) {
var o = jph.parse('{"foo": "bar"}');
Code.expect(o.foo).to.equal('bar');
done();
});
lab.test('helpful error for bad JSON', function (done) {
var bad = "{'foo': 'bar'}";
Code.expect(function () { JSON.parse(bad) }).to.throw();
Code.expect(function () { jph.parse(bad) }).to.throw(SyntaxError, "Unexpected token '\\'' at 1:2\n" + bad + '\n ^');
done();
});
lab.test('fails if reviver throws', function (done) {
function badReviver() { throw new ReferenceError('silly'); }
Code.expect(function () { jph.parse('3', badReviver) }).to.throw(ReferenceError, 'silly');
done();
});
+11
View File
@@ -0,0 +1,11 @@
var Code = require('code'),
Lab = require('lab'),
lab = lab.script;
exports.lab = lab;
lab.test('tests run and work', function (done) {
Code.expect(1+1).to.equal(2);
done();
});