Lint serializedobject test

This commit is contained in:
wltsmrz
2015-03-06 13:01:57 -08:00
parent 2fcd09072f
commit 6e16bf68ae
3 changed files with 18 additions and 8 deletions

View File

@@ -713,7 +713,7 @@ Amount.prototype.parse_json = function(j) {
Amount.prototype.parse_native = function(j) {
if (j && typeof j === 'string' && !isNaN(j)) {
if (j.indexOf('.') >= 0) {
throw new Error('Native amounts must be specified in integer drops')
throw new Error('Native amounts must be specified in integer drops');
}
var value = new BigNumber(j);
this._is_native = true;

View File

@@ -46,10 +46,9 @@ function SerializedObject(buf) {
this.pointer = 0;
}
SerializedObject.from_json = function(obj, options) {
SerializedObject.from_json = function(obj) {
// Create a copy of the object so we don't modify it
obj = extend(true, {}, obj);
options = _.extend({strict: true}, options);
var so = new SerializedObject();
var typedef;
@@ -95,7 +94,7 @@ SerializedObject.from_json = function(obj, options) {
// ND: This from_*json* seems a reasonable place to put validation of `json`
SerializedObject.check_no_missing_fields(typedef, obj);
so.serialize(typedef, obj, options);
so.serialize(typedef, obj);
return so;
};
@@ -237,9 +236,9 @@ SerializedObject.jsonify_structure = function(structure, field_name) {
return output;
};
SerializedObject.prototype.serialize = function(typedef, obj, options) {
SerializedObject.prototype.serialize = function(typedef, obj) {
// Serialize object without end marker
stypes.Object.serialize(this, obj, options, true);
stypes.Object.serialize(this, obj, true);
// ST: Old serialization
/*

View File

@@ -1,3 +1,15 @@
'use strict';
/* eslint-disable max-len*/
/* eslint-disable key-spacing*/
/* eslint-disable no-spaced-func*/
/* eslint-disable space-before-blocks*/
/* eslint-disable space-unary-ops*/
/* eslint-disable no-void*/
/* eslint-disable semi*/
/* eslint-disable no-unused-vars*/
/* eslint-disable quotes*/
var assert = require('assert');
var SerializedObject = require('ripple-lib').SerializedObject;
var Amount = require('ripple-lib').Amount;
@@ -160,7 +172,6 @@ describe('Serialized object', function() {
});
describe('Memos', function() {
var input_json;
beforeEach(function() {
@@ -273,7 +284,7 @@ describe('Serialized object', function() {
it('should serialize json with memo - match hex output', function() {
var input_json = {
input_json = {
Flags: 2147483648,
TransactionType: 'Payment',
Account: 'rhXzSyt1q9J8uiFXpK3qSugAAPJKXLtnrF',