You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
909 B
35 lines
909 B
'use strict';
|
|
/* jshint unused: false */
|
|
|
|
var should = require('chai').should();
|
|
var expect = require('chai').expect;
|
|
|
|
var bitcore = require('../..');
|
|
var JSUtil = bitcore.util.js;
|
|
|
|
describe('js utils', function() {
|
|
|
|
describe('isValidJSON', function() {
|
|
|
|
var hexa = '8080808080808080808080808080808080808080808080808080808080808080';
|
|
var json = '{"key": ["value", "value2"]}';
|
|
var json2 = '["value", "value2", {"key": "value"}]';
|
|
|
|
it('does not mistake an integer as valid json object', function() {
|
|
var valid = JSUtil.isValidJSON(hexa);
|
|
valid.should.equal(false);
|
|
});
|
|
|
|
it('correctly validates a json object', function() {
|
|
var valid = JSUtil.isValidJSON(json);
|
|
valid.should.equal(true);
|
|
});
|
|
|
|
it('correctly validates an array json object', function() {
|
|
var valid = JSUtil.isValidJSON(json);
|
|
valid.should.equal(true);
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|