THRIFT-5811: Update eslint & prettier
Client: js
Patch: Cameron Martin
This closes #3087
diff --git a/lib/nodejs/test/deep-constructor.test.js b/lib/nodejs/test/deep-constructor.test.js
index a91ddb1..e5ac3f8 100644
--- a/lib/nodejs/test/deep-constructor.test.js
+++ b/lib/nodejs/test/deep-constructor.test.js
@@ -24,7 +24,7 @@
function serializeBinary(data) {
let buff;
- const transport = new thrift.TBufferedTransport(null, function(msg) {
+ const transport = new thrift.TBufferedTransport(null, function (msg) {
buff = msg;
});
const prot = new thrift.TBinaryProtocol(transport);
@@ -43,7 +43,7 @@
function serializeJSON(data) {
let buff;
- const transport = new thrift.TBufferedTransport(null, function(msg) {
+ const transport = new thrift.TBufferedTransport(null, function (msg) {
buff = msg;
});
const protocol = new thrift.TJSONProtocol(transport);
@@ -70,17 +70,17 @@
struct_list_field: [
new ttypes.Simple({ value: "b" }),
- new ttypes.Simple({ value: "c" })
+ new ttypes.Simple({ value: "c" }),
],
struct_set_field: [
new ttypes.Simple({ value: "d" }),
- new ttypes.Simple({ value: "e" })
+ new ttypes.Simple({ value: "e" }),
],
struct_map_field: {
A: new ttypes.Simple({ value: "f" }),
- B: new ttypes.Simple({ value: "g" })
+ B: new ttypes.Simple({ value: "g" }),
},
struct_nested_containers_field: [
@@ -88,46 +88,46 @@
{
C: [
new ttypes.Simple({ value: "h" }),
- new ttypes.Simple({ value: "i" })
- ]
- }
- ]
+ new ttypes.Simple({ value: "i" }),
+ ],
+ },
+ ],
],
struct_nested_containers_field2: {
D: [
{
- DA: new ttypes.Simple({ value: "j" })
+ DA: new ttypes.Simple({ value: "j" }),
},
{
- DB: new ttypes.Simple({ value: "k" })
- }
- ]
+ DB: new ttypes.Simple({ value: "k" }),
+ },
+ ],
},
list_of_list_field: [
["l00", "l01", "l02"],
["l10", "l11", "l12"],
- ["l20", "l21", "l22"]
+ ["l20", "l21", "l22"],
],
list_of_list_of_list_field: [
[
["m000", "m001", "m002"],
["m010", "m011", "m012"],
- ["m020", "m021", "m022"]
+ ["m020", "m021", "m022"],
],
[
["m100", "m101", "m102"],
["m110", "m111", "m112"],
- ["m120", "m121", "m122"]
+ ["m120", "m121", "m122"],
],
[
["m200", "m201", "m202"],
["m210", "m211", "m212"],
- ["m220", "m221", "m222"]
- ]
- ]
+ ["m220", "m221", "m222"],
+ ],
+ ],
});
}
@@ -141,51 +141,51 @@
struct_map_field: {
A: { value: "f" },
- B: { value: "g" }
+ B: { value: "g" },
},
struct_nested_containers_field: [
[
{
- C: [{ value: "h" }, { value: "i" }]
- }
- ]
+ C: [{ value: "h" }, { value: "i" }],
+ },
+ ],
],
struct_nested_containers_field2: {
D: [
{
- DA: { value: "j" }
+ DA: { value: "j" },
},
{
- DB: { value: "k" }
- }
- ]
+ DB: { value: "k" },
+ },
+ ],
},
list_of_list_field: [
["l00", "l01", "l02"],
["l10", "l11", "l12"],
- ["l20", "l21", "l22"]
+ ["l20", "l21", "l22"],
],
list_of_list_of_list_field: [
[
["m000", "m001", "m002"],
["m010", "m011", "m012"],
- ["m020", "m021", "m022"]
+ ["m020", "m021", "m022"],
],
[
["m100", "m101", "m102"],
["m110", "m111", "m112"],
- ["m120", "m121", "m122"]
+ ["m120", "m121", "m122"],
],
[
["m200", "m201", "m202"],
["m210", "m211", "m212"],
- ["m220", "m221", "m222"]
- ]
- ]
+ ["m220", "m221", "m222"],
+ ],
+ ],
};
}
@@ -244,7 +244,7 @@
function createTestCases(serialize, deserialize) {
const cases = {
- "Serialize/deserialize should return equal object": function(assert) {
+ "Serialize/deserialize should return equal object": function (assert) {
const tObj = createThriftObj();
const received = deserialize(serialize(tObj), ttypes.Complex);
assert.ok(tObj !== received, "not the same object");
@@ -252,51 +252,49 @@
assert.end();
},
- "Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects": function(
- assert
- ) {
- const tObj1 = createThriftObj();
- const tObj2 = new ttypes.Complex(createJsObj());
- assertValues(tObj2, assert);
- const s1 = serialize(tObj1);
- const s2 = serialize(tObj2);
- assert.ok(bufferEquals(s1, s2));
- assert.end();
- },
+ "Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects":
+ function (assert) {
+ const tObj1 = createThriftObj();
+ const tObj2 = new ttypes.Complex(createJsObj());
+ assertValues(tObj2, assert);
+ const s1 = serialize(tObj1);
+ const s2 = serialize(tObj2);
+ assert.ok(bufferEquals(s1, s2));
+ assert.end();
+ },
- "Modifications to args object should not affect constructed Thrift object": function(
- assert
- ) {
- const args = createJsObj();
- assertValues(args, assert);
+ "Modifications to args object should not affect constructed Thrift object":
+ function (assert) {
+ const args = createJsObj();
+ assertValues(args, assert);
- const tObj = new ttypes.Complex(args);
- assertValues(tObj, assert);
+ const tObj = new ttypes.Complex(args);
+ assertValues(tObj, assert);
- args.struct_field.value = "ZZZ";
- args.struct_list_field[0].value = "ZZZ";
- args.struct_list_field[1].value = "ZZZ";
- args.struct_set_field[0].value = "ZZZ";
- args.struct_set_field[1].value = "ZZZ";
- args.struct_map_field.A.value = "ZZZ";
- args.struct_map_field.B.value = "ZZZ";
- args.struct_nested_containers_field[0][0].C[0] = "ZZZ";
- args.struct_nested_containers_field[0][0].C[1] = "ZZZ";
- args.struct_nested_containers_field2.D[0].DA = "ZZZ";
- args.struct_nested_containers_field2.D[0].DB = "ZZZ";
+ args.struct_field.value = "ZZZ";
+ args.struct_list_field[0].value = "ZZZ";
+ args.struct_list_field[1].value = "ZZZ";
+ args.struct_set_field[0].value = "ZZZ";
+ args.struct_set_field[1].value = "ZZZ";
+ args.struct_map_field.A.value = "ZZZ";
+ args.struct_map_field.B.value = "ZZZ";
+ args.struct_nested_containers_field[0][0].C[0] = "ZZZ";
+ args.struct_nested_containers_field[0][0].C[1] = "ZZZ";
+ args.struct_nested_containers_field2.D[0].DA = "ZZZ";
+ args.struct_nested_containers_field2.D[0].DB = "ZZZ";
- assertValues(tObj, assert);
- assert.end();
- },
+ assertValues(tObj, assert);
+ assert.end();
+ },
- "nulls are ok": function(assert) {
+ "nulls are ok": function (assert) {
const tObj = new ttypes.Complex({
struct_field: null,
struct_list_field: null,
struct_set_field: null,
struct_map_field: null,
struct_nested_containers_field: null,
- struct_nested_containers_field2: null
+ struct_nested_containers_field2: null,
});
const received = deserialize(serialize(tObj), ttypes.Complex);
assert.strictEqual(tObj.struct_field, null);
@@ -305,9 +303,9 @@
assert.end();
},
- "Can make list with objects": function(assert) {
+ "Can make list with objects": function (assert) {
const tObj = new ttypes.ComplexList({
- struct_list_field: [new ttypes.Complex({})]
+ struct_list_field: [new ttypes.Complex({})],
});
const innerObj = tObj.struct_list_field[0];
assert.ok(innerObj instanceof ttypes.Complex);
@@ -318,13 +316,13 @@
assert.strictEqual(innerObj.struct_nested_containers_field, null);
assert.strictEqual(innerObj.struct_nested_containers_field2, null);
assert.end();
- }
+ },
};
return cases;
}
function run(name, cases) {
- Object.keys(cases).forEach(function(caseName) {
+ Object.keys(cases).forEach(function (caseName) {
test(name + ": " + caseName, cases[caseName]);
});
}