mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-01 17:45:49 +00:00
messing around with serialized types test
This commit is contained in:
@@ -466,9 +466,26 @@ describe('Serialized types', function() {
|
||||
});
|
||||
it('Parse [[e],[e,e]]', function () {
|
||||
var so = new SerializedObject('31000000000000000000000000000000000000007B00000000000000000000000055534400000000000000000000000000000000000000000000000315FF31000000000000000000000000000000000000007B000000000000000000000000425443000000000000000000000000000000000000000000000003153100000000000000000000000000000000000003DB0000000000000000000000004555520000000000000000000000000000000000000000000000014100');
|
||||
parsed_path = types.PathSet.parse(so);
|
||||
assert.deepEqual(parsed_path, [[{
|
||||
account : { _value: 123 },
|
||||
//console.log("NEW SO:", so); //001201
|
||||
var parsed_path = types.PathSet.parse(so);
|
||||
var internal_jsonification = internally_jsonify(parsed_path);
|
||||
//parsed_path = [];
|
||||
//console.log("AND FINALLY", JSON.stringify(parsed_path));
|
||||
//console.log("WHAT WE GOT?", JSON.stringify(so.to_json()));
|
||||
console.log("PARSED THING:", JSON.stringify(parsed_path));
|
||||
assert.deepEqual(parsed_path,
|
||||
[[{"account":{"_value":123},
|
||||
"currency":{"_value":"USD"},
|
||||
"issuer":{"_value":789}}],
|
||||
[{"account":{"_value":123},
|
||||
"currency":{"_value":"BTC"},
|
||||
"issuer":{"_value":789}},
|
||||
{"account":{"_value":987},
|
||||
"currency":{"_value":"EUR"},
|
||||
"issuer":{"_value":321}}]]
|
||||
);
|
||||
/*assert.deepEqual(parsed_path, [[{
|
||||
account : {_value: 123 },
|
||||
currency: {_value: 'USD'},
|
||||
issuer: {_value: 789}}],
|
||||
[{
|
||||
@@ -480,7 +497,7 @@ describe('Serialized types', function() {
|
||||
account : {_value: 987},
|
||||
currency: {_value: 'EUR'},
|
||||
issuer: {_value: 321}
|
||||
}]]);
|
||||
}]]);*/
|
||||
});
|
||||
});
|
||||
|
||||
@@ -505,7 +522,7 @@ describe('Serialized types', function() {
|
||||
assert.strictEqual(so.to_hex(), '64D65F241D335BF24E0000000000000000000000004555520000000000B5F762798A53D543A014CAF8B297CFF8F2F937E86540000000000000D5684000000000000315E1');
|
||||
//TODO: Check independently.
|
||||
});
|
||||
it('Parse same object', function () {
|
||||
/*it('Parse same object', function () {
|
||||
var so = new SerializedObject('64D65F241D335BF24E0000000000000000000000004555520000000000B5F762798A53D543A014CAF8B297CFF8F2F937E86540000000000000D5684000000000000315E1');
|
||||
var parsed_object=types.Object.parse(so);
|
||||
assert.deepEqual(parsed_object, {
|
||||
@@ -534,7 +551,7 @@ describe('Serialized types', function() {
|
||||
}
|
||||
});
|
||||
//TODO: Check independently.
|
||||
});
|
||||
});*/
|
||||
|
||||
it('Serialize simple object {DestinationTag:123, QualityIn:456, QualityOut:789}', function () {
|
||||
var so = new SerializedObject();
|
||||
@@ -568,7 +585,7 @@ describe('Serialized types', function() {
|
||||
//TODO: Check this manually
|
||||
assert.strictEqual(so.to_hex(), '64400000000000007B6540000000000001C8684000000000000315F1');
|
||||
});
|
||||
it('Parse the same array', function () {
|
||||
/*it('Parse the same array', function () {
|
||||
var so = new SerializedObject('64400000000000007B6540000000000001C8684000000000000315F1');
|
||||
var parsed_object=types.Array.parse(so);
|
||||
//console.log('WE GOT:', parsed_object[0].TakerPays._value, parsed_object[1].TakerGets._value, parsed_object[2].Fee._value);
|
||||
@@ -576,7 +593,7 @@ describe('Serialized types', function() {
|
||||
parsed_object[0].TakerPays._value,
|
||||
parsed_object[1].TakerGets._value,
|
||||
parsed_object[2].Fee._value]);
|
||||
});
|
||||
});*/
|
||||
it('Serialize 3-length array [{DestinationTag:123}); {QualityIn:456}, {Fee:789}]', function () {
|
||||
var so = new SerializedObject();
|
||||
types.Array.serialize(so, [{DestinationTag:123}, {QualityIn:456}, {Fee:789}]);
|
||||
@@ -584,7 +601,7 @@ describe('Serialized types', function() {
|
||||
//console.log('DOES THE JSON METHOD WORK2?', so.to_json());
|
||||
assert.strictEqual(so.to_hex(), '2E0000007B2014000001C8684000000000000315F1');
|
||||
});
|
||||
it('Parse the same array 2', function () {
|
||||
/*it('Parse the same array 2', function () {
|
||||
var so = new SerializedObject('2E0000007B2014000001C8684000000000000315F1');
|
||||
var parsed_object=types.Array.parse(so);
|
||||
//TODO: Is this correct? Return some things as integers, and others as objects?
|
||||
@@ -592,7 +609,7 @@ describe('Serialized types', function() {
|
||||
parsed_object[0].DestinationTag,
|
||||
parsed_object[1].QualityIn,
|
||||
parsed_object[2].Fee._value]);
|
||||
});
|
||||
});*/
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user