THRIFT-3293 JavaScript: null values turn into empty structs in constructor
Patch: Håkon Hitland
diff --git a/lib/nodejs/test/deep-constructor.test.js b/lib/nodejs/test/deep-constructor.test.js
index 41e7dd0..8dd29ee 100644
--- a/lib/nodejs/test/deep-constructor.test.js
+++ b/lib/nodejs/test/deep-constructor.test.js
@@ -213,9 +213,25 @@
struct_nested_containers_field2: null
});
var received = deserialize(serialize(tObj), ttypes.Complex);
+ assert.strictEqual(tObj.struct_field, null);
assert.ok(tObj !== received);
assert.deepEqual(tObj, received);
assert.end();
+ },
+
+ "Can make list with objects": function(assert) {
+ var tObj = new ttypes.ComplexList({
+ "struct_list_field": [new ttypes.Complex({})]
+ });
+ var innerObj = tObj.struct_list_field[0];
+ assert.ok(innerObj instanceof ttypes.Complex)
+ assert.strictEqual(innerObj.struct_field, null);
+ assert.strictEqual(innerObj.struct_list_field, null);
+ assert.strictEqual(innerObj.struct_set_field, null);
+ assert.strictEqual(innerObj.struct_map_field, null);
+ assert.strictEqual(innerObj.struct_nested_containers_field, null);
+ assert.strictEqual(innerObj.struct_nested_containers_field2, null);
+ assert.end();
}
};