THRIFT-5811: Update eslint & prettier
Client: js
Patch: Cameron Martin
This closes #3087
diff --git a/lib/nodejs/test/binary.test.js b/lib/nodejs/test/binary.test.js
index 187cd18..343d39a 100644
--- a/lib/nodejs/test/binary.test.js
+++ b/lib/nodejs/test/binary.test.js
@@ -21,7 +21,7 @@
const binary = require("thrift/binary");
const cases = {
- "Should read signed byte": function(assert) {
+ "Should read signed byte": function (assert) {
assert.equal(1, binary.readByte(0x01));
assert.equal(-1, binary.readByte(0xff));
@@ -29,12 +29,12 @@
assert.equal(-128, binary.readByte(0x80));
assert.end();
},
- "Should write byte": function(assert) {
+ "Should write byte": function (assert) {
//Protocol simply writes to the buffer. Nothing to test.. yet.
assert.ok(true);
assert.end();
},
- "Should read I16": function(assert) {
+ "Should read I16": function (assert) {
assert.equal(0, binary.readI16([0x00, 0x00]));
assert.equal(1, binary.readI16([0x00, 0x01]));
assert.equal(-1, binary.readI16([0xff, 0xff]));
@@ -46,7 +46,7 @@
assert.end();
},
- "Should write I16": function(assert) {
+ "Should write I16": function (assert) {
assert.deepEqual([0x00, 0x00], binary.writeI16([], 0));
assert.deepEqual([0x00, 0x01], binary.writeI16([], 1));
assert.deepEqual([0xff, 0xff], binary.writeI16([], -1));
@@ -58,7 +58,7 @@
assert.end();
},
- "Should read I32": function(assert) {
+ "Should read I32": function (assert) {
assert.equal(0, binary.readI32([0x00, 0x00, 0x00, 0x00]));
assert.equal(1, binary.readI32([0x00, 0x00, 0x00, 0x01]));
assert.equal(-1, binary.readI32([0xff, 0xff, 0xff, 0xff]));
@@ -70,7 +70,7 @@
assert.end();
},
- "Should write I32": function(assert) {
+ "Should write I32": function (assert) {
assert.deepEqual([0x00, 0x00, 0x00, 0x00], binary.writeI32([], 0));
assert.deepEqual([0x00, 0x00, 0x00, 0x01], binary.writeI32([], 1));
assert.deepEqual([0xff, 0xff, 0xff, 0xff], binary.writeI32([], -1));
@@ -78,137 +78,139 @@
// Min I32
assert.deepEqual(
[0x80, 0x00, 0x00, 0x00],
- binary.writeI32([], -2147483648)
+ binary.writeI32([], -2147483648),
);
// Max I32
assert.deepEqual([0x7f, 0xff, 0xff, 0xff], binary.writeI32([], 2147483647));
assert.end();
},
- "Should read doubles": function(assert) {
+ "Should read doubles": function (assert) {
assert.equal(
0,
- binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.equal(
0,
- binary.readDouble([0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.equal(
1,
- binary.readDouble([0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.equal(
2,
- binary.readDouble([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.equal(
-2,
- binary.readDouble([0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.equal(
Math.PI,
- binary.readDouble([0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18])
+ binary.readDouble([0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18]),
);
assert.equal(
Infinity,
- binary.readDouble([0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.equal(
-Infinity,
- binary.readDouble([0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
assert.ok(
- isNaN(binary.readDouble([0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
+ isNaN(
+ binary.readDouble([0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
+ ),
);
assert.equal(
1 / 3,
- binary.readDouble([0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55])
+ binary.readDouble([0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55]),
);
// Min subnormal positive double
assert.equal(
4.9406564584124654e-324,
- binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01])
+ binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]),
);
// Min normal positive double
assert.equal(
2.2250738585072014e-308,
- binary.readDouble([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
+ binary.readDouble([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
);
// Max positive double
assert.equal(
1.7976931348623157e308,
- binary.readDouble([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
+ binary.readDouble([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]),
);
assert.end();
},
- "Should write doubles": function(assert) {
+ "Should write doubles": function (assert) {
assert.deepEqual(
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], 0)
+ binary.writeDouble([], 0),
);
assert.deepEqual(
[0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], 1)
+ binary.writeDouble([], 1),
);
assert.deepEqual(
[0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], 2)
+ binary.writeDouble([], 2),
);
assert.deepEqual(
[0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], -2)
+ binary.writeDouble([], -2),
);
assert.deepEqual(
[0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18],
- binary.writeDouble([], Math.PI)
+ binary.writeDouble([], Math.PI),
);
assert.deepEqual(
[0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], Infinity)
+ binary.writeDouble([], Infinity),
);
assert.deepEqual(
[0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], -Infinity)
+ binary.writeDouble([], -Infinity),
);
assert.deepEqual(
[0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], NaN)
+ binary.writeDouble([], NaN),
);
assert.deepEqual(
[0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55],
- binary.writeDouble([], 1 / 3)
+ binary.writeDouble([], 1 / 3),
);
// Min subnormal positive double
assert.deepEqual(
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01],
- binary.writeDouble([], 4.9406564584124654e-324)
+ binary.writeDouble([], 4.9406564584124654e-324),
);
// Min normal positive double
assert.deepEqual(
[0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
- binary.writeDouble([], 2.2250738585072014e-308)
+ binary.writeDouble([], 2.2250738585072014e-308),
);
// Max positive double
assert.deepEqual(
[0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff],
- binary.writeDouble([], 1.7976931348623157e308)
+ binary.writeDouble([], 1.7976931348623157e308),
);
assert.end();
- }
+ },
};
-Object.keys(cases).forEach(function(caseName) {
+Object.keys(cases).forEach(function (caseName) {
test(caseName, cases[caseName]);
});
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index 31ea06e..1d137ff 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -25,8 +25,8 @@
const ThriftTest = require(`./${helpers.genPath}/ThriftTest`);
const ThriftTestDriver = require("./test_driver").ThriftTestDriver;
-const ThriftTestDriverPromise = require("./test_driver")
- .ThriftTestDriverPromise;
+const ThriftTestDriverPromise =
+ require("./test_driver").ThriftTestDriverPromise;
const SecondService = require(`./${helpers.genPath}/SecondService`);
const program = require("commander");
@@ -34,24 +34,24 @@
program
.option(
"-p, --protocol <protocol>",
- "Set thrift protocol (binary|compact|json) [protocol]"
+ "Set thrift protocol (binary|compact|json) [protocol]",
)
.option(
"-t, --transport <transport>",
- "Set thrift transport (buffered|framed|http) [transport]"
+ "Set thrift transport (buffered|framed|http) [transport]",
)
.option("--port <port>", "Set thrift server port number to connect", 9090)
.option("--host <host>", "Set thrift server host to connect", "localhost")
.option(
"--domain-socket <path>",
- "Set thrift server unix domain socket to connect"
+ "Set thrift server unix domain socket to connect",
)
.option("--ssl", "use SSL transport")
.option("--callback", "test with callback style functions")
.option(
"-t, --type <type>",
"Select server type (http|multiplex|tcp|websocket)",
- "tcp"
+ "tcp",
)
.option("--es6", "Use es6 code")
.option("--es5", "Use es5 code")
@@ -76,7 +76,7 @@
const options = {
transport: helpers.transports[program.transport],
- protocol: helpers.protocols[program.protocol]
+ protocol: helpers.protocols[program.protocol],
};
if (type === "http" || type === "websocket") {
@@ -128,7 +128,7 @@
connection.open();
}
-connection.on("error", function(err) {
+connection.on("error", function (err) {
assert(false, err);
});
@@ -141,11 +141,11 @@
const secondclient = mp.createClient(
"SecondService",
SecondService,
- connection
+ connection,
);
- connection.on("connect", function() {
- secondclient.secondtestString("Test", function(err, response) {
+ connection.on("connect", function () {
+ secondclient.secondtestString("Test", function (err, response) {
assert(!err);
assert.equal('testString("Test")', response);
});
@@ -161,7 +161,7 @@
}
function runTests() {
- testDriver(client, function(status) {
+ testDriver(client, function (status) {
console.log(status);
if (type !== "http" && type !== "websocket") {
connection.end();
@@ -172,4 +172,4 @@
});
}
-exports.expressoTest = function() {};
+exports.expressoTest = function () {};
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]);
});
}
diff --git a/lib/nodejs/test/episodic-code-generation-test/client.js b/lib/nodejs/test/episodic-code-generation-test/client.js
index 55dc702..631bfe7 100644
--- a/lib/nodejs/test/episodic-code-generation-test/client.js
+++ b/lib/nodejs/test/episodic-code-generation-test/client.js
@@ -37,21 +37,21 @@
const options = {
transport: thrift.TBufferedTransport,
- protocol: thrift.TJSONProtocol
+ protocol: thrift.TJSONProtocol,
};
const connection = thrift.createConnection(host, port, options);
-const testDriver = function(client, callback) {
- test("NodeJS episodic compilation client-server test", function(assert) {
+const testDriver = function (client, callback) {
+ test("NodeJS episodic compilation client-server test", function (assert) {
const type1Object = new Types.Type1();
type1Object.number = 42;
type1Object.message = "The answer";
- client.testEpisode(type1Object, function(err, response) {
+ client.testEpisode(type1Object, function (err, response) {
assert.error(err, "no callback error");
assert.equal(response.number, type1Object.number + 1);
assert.equal(
response.message,
- type1Object.message + " [Hello from the server]"
+ type1Object.message + " [Hello from the server]",
);
assert.end();
callback("Server successfully tested");
@@ -59,7 +59,7 @@
});
};
-connection.on("error", function(err) {
+connection.on("error", function (err) {
assert(false, err);
});
@@ -68,10 +68,10 @@
runTests();
function runTests() {
- testDriver(client, function(status) {
+ testDriver(client, function (status) {
console.log(status);
connection.destroy();
});
}
-exports.expressoTest = function() {};
+exports.expressoTest = function () {};
diff --git a/lib/nodejs/test/episodic-code-generation-test/server.js b/lib/nodejs/test/episodic-code-generation-test/server.js
index 2917b68..feca380 100644
--- a/lib/nodejs/test/episodic-code-generation-test/server.js
+++ b/lib/nodejs/test/episodic-code-generation-test/server.js
@@ -33,17 +33,17 @@
const options = {
transport: thrift.TBufferedTransport,
- protocol: thrift.TJSONProtocol
+ protocol: thrift.TJSONProtocol,
};
const ServiceHandler = {
- testEpisode: function(receivedType1Object) {
+ testEpisode: function (receivedType1Object) {
const type1Object = new Types.Type1();
type1Object.number = receivedType1Object.number + 1;
type1Object.message =
receivedType1Object.message + " [Hello from the server]";
return type1Object;
- }
+ },
};
const server = thrift.createServer(Service, ServiceHandler, options);
diff --git a/lib/nodejs/test/exceptions.js b/lib/nodejs/test/exceptions.js
index f30f987..4119e76 100644
--- a/lib/nodejs/test/exceptions.js
+++ b/lib/nodejs/test/exceptions.js
@@ -26,23 +26,23 @@
const e = new thrift.TApplicationException(1, "foo");
assert.ok(
e instanceof thrift.TApplicationException,
- "is instanceof TApplicationException"
+ "is instanceof TApplicationException",
);
assert.ok(e instanceof thrift.TException, "is instanceof TException");
assert.ok(e instanceof Error, "is instanceof Error");
assert.equal(typeof e.stack, "string", "has stack trace");
assert.ok(
/^TApplicationException: foo/.test(e.stack),
- "Stack trace has correct error name and message"
+ "Stack trace has correct error name and message",
);
assert.ok(
e.stack.indexOf("test/exceptions.js:7:11") !== -1,
- "stack trace starts on correct line and column"
+ "stack trace starts on correct line and column",
);
assert.equal(
e.name,
"TApplicationException",
- "has function name TApplicationException"
+ "has function name TApplicationException",
);
assert.equal(e.message, "foo", 'has error message "foo"');
assert.equal(e.type, 1, "has type 1");
@@ -53,23 +53,23 @@
const e = new thrift.TApplicationException(1, 100);
assert.ok(
e instanceof thrift.TApplicationException,
- "is instanceof TApplicationException"
+ "is instanceof TApplicationException",
);
assert.ok(e instanceof thrift.TException, "is instanceof TException");
assert.ok(e instanceof Error, "is instanceof Error");
assert.equal(typeof e.stack, "string", "has stack trace");
assert.ok(
/^TApplicationException: 100/.test(e.stack),
- "Stack trace has correct error name and message"
+ "Stack trace has correct error name and message",
);
assert.ok(
e.stack.indexOf("test/exceptions.js:7:11") !== -1,
- "stack trace starts on correct line and column"
+ "stack trace starts on correct line and column",
);
assert.equal(
e.name,
"TApplicationException",
- "has function name TApplicationException"
+ "has function name TApplicationException",
);
assert.equal(e.message, 100, "has error message 100");
assert.equal(e.type, 1, "has type 1");
@@ -83,11 +83,11 @@
assert.equal(typeof e.stack, "string", "has stack trace");
assert.ok(
/^TException: foo/.test(e.stack),
- "Stack trace has correct error name and message"
+ "Stack trace has correct error name and message",
);
assert.ok(
e.stack.indexOf("test/exceptions.js:21:11") !== -1,
- "stack trace starts on correct line and column"
+ "stack trace starts on correct line and column",
);
assert.equal(e.name, "TException", "has function name TException");
assert.equal(e.message, "foo", 'has error message "foo"');
@@ -98,22 +98,22 @@
const e = new thrift.TProtocolException(1, "foo");
assert.ok(
e instanceof thrift.TProtocolException,
- "is instanceof TProtocolException"
+ "is instanceof TProtocolException",
);
assert.ok(e instanceof Error, "is instanceof Error");
assert.equal(typeof e.stack, "string", "has stack trace");
assert.ok(
/^TProtocolException: foo/.test(e.stack),
- "Stack trace has correct error name and message"
+ "Stack trace has correct error name and message",
);
assert.ok(
e.stack.indexOf("test/exceptions.js:33:11") !== -1,
- "stack trace starts on correct line and column"
+ "stack trace starts on correct line and column",
);
assert.equal(
e.name,
"TProtocolException",
- "has function name TProtocolException"
+ "has function name TProtocolException",
);
assert.equal(e.message, "foo", 'has error message "foo"');
assert.equal(e.type, 1, "has type 1");
@@ -124,22 +124,22 @@
const e = new InputBufferUnderrunError("foo");
assert.ok(
e instanceof InputBufferUnderrunError,
- "is instanceof InputBufferUnderrunError"
+ "is instanceof InputBufferUnderrunError",
);
assert.ok(e instanceof Error, "is instanceof Error");
assert.equal(typeof e.stack, "string", "has stack trace");
assert.ok(
/^InputBufferUnderrunError: foo/.test(e.stack),
- "Stack trace has correct error name and message"
+ "Stack trace has correct error name and message",
);
assert.ok(
e.stack.indexOf("test/exceptions.js:46:11") !== -1,
- "stack trace starts on correct line and column"
+ "stack trace starts on correct line and column",
);
assert.equal(
e.name,
"InputBufferUnderrunError",
- "has function name InputBufferUnderrunError"
+ "has function name InputBufferUnderrunError",
);
assert.equal(e.message, "foo", 'has error message "foo"');
assert.end();
diff --git a/lib/nodejs/test/header.test.js b/lib/nodejs/test/header.test.js
index 12f1557..24f49be 100644
--- a/lib/nodejs/test/header.test.js
+++ b/lib/nodejs/test/header.test.js
@@ -26,11 +26,11 @@
const path = require("path");
const headerPayload = fs.readFileSync(
- path.join(__dirname, "test_header_payload")
+ path.join(__dirname, "test_header_payload"),
);
const cases = {
- "Should read headers from payload": function(assert) {
+ "Should read headers from payload": function (assert) {
const transport = new TFramedTransport();
transport.inBuf = Buffer.from(headerPayload);
@@ -39,7 +39,7 @@
assert.equals(headers.Trace, "abcde");
assert.end();
},
- "Should read different headers from different payload": function(assert) {
+ "Should read different headers from different payload": function (assert) {
const transport = new TFramedTransport();
const buf = Buffer.from(headerPayload);
buf[24] = 115; // Change Parent to Parens
@@ -52,7 +52,7 @@
assert.equals(headers.Trace, "abcde");
assert.end();
},
- "Should read headers when reading message begin": function(assert) {
+ "Should read headers when reading message begin": function (assert) {
const transport = new TFramedTransport();
transport.inBuf = Buffer.from(headerPayload);
const protocol = new THeaderProtocol(transport);
@@ -65,7 +65,7 @@
assert.equals(result.mtype, thrift.Thrift.MessageType.CALL);
assert.end();
},
- "Should be able to write headers": function(assert) {
+ "Should be able to write headers": function (assert) {
const writeTransport = new TFramedTransport();
writeTransport.setProtocolId(THeaderTransport.SubprotocolId.BINARY);
writeTransport.setWriteHeader("Hihihihi", "hohohoho");
@@ -84,7 +84,7 @@
assert.equals(headers.a, "z");
assert.end();
},
- "Separate transports should have separate headers": function(assert) {
+ "Separate transports should have separate headers": function (assert) {
const writeTransport = new TFramedTransport();
writeTransport.setProtocolId(THeaderTransport.SubprotocolId.BINARY);
writeTransport.setWriteHeader("foo", "bar");
@@ -101,8 +101,8 @@
assert.equals(otherHeaders.otherfoo, "baz");
assert.end();
},
- "Should handle large messages without crashing": function(assert) {
- const callback = function() {};
+ "Should handle large messages without crashing": function (assert) {
+ const callback = function () {};
const onData = TFramedTransport.receiver(callback);
const largeChunkSize = 2 * 100 * 1024 * 1024;
@@ -112,9 +112,9 @@
onData(Buffer.concat([sizeBuffer, largeChunk]));
assert.end();
- }
+ },
};
-Object.keys(cases).forEach(function(caseName) {
+Object.keys(cases).forEach(function (caseName) {
test(caseName, cases[caseName]);
});
diff --git a/lib/nodejs/test/helpers.js b/lib/nodejs/test/helpers.js
index f3c27b3..51a0523 100644
--- a/lib/nodejs/test/helpers.js
+++ b/lib/nodejs/test/helpers.js
@@ -22,14 +22,14 @@
module.exports.transports = {
buffered: thrift.TBufferedTransport,
- framed: thrift.TFramedTransport
+ framed: thrift.TFramedTransport,
};
module.exports.protocols = {
json: thrift.TJSONProtocol,
binary: thrift.TBinaryProtocol,
compact: thrift.TCompactProtocol,
- header: thrift.THeaderProtocol
+ header: thrift.THeaderProtocol,
};
module.exports.ecmaMode = process.argv.includes("--es6") ? "es6" : "es5";
diff --git a/lib/nodejs/test/int64.test.js b/lib/nodejs/test/int64.test.js
index 27ad28c..21d4d58 100644
--- a/lib/nodejs/test/int64.test.js
+++ b/lib/nodejs/test/int64.test.js
@@ -23,7 +23,7 @@
const test = require("tape");
const cases = {
- "should correctly generate Int64 constants": function(assert) {
+ "should correctly generate Int64 constants": function (assert) {
const EXPECTED_SMALL_INT64_AS_NUMBER = 42;
const EXPECTED_SMALL_INT64 = new Int64(42);
const EXPECTED_MAX_JS_SAFE_INT64 = new Int64(Number.MAX_SAFE_INTEGER);
@@ -39,7 +39,7 @@
EXPECTED_MAX_JS_SAFE_PLUS_ONE_INT64,
EXPECTED_MIN_JS_SAFE_MINUS_ONE_INT64,
EXPECTED_MAX_SIGNED_INT64,
- EXPECTED_MIN_SIGNED_INT64
+ EXPECTED_MIN_SIGNED_INT64,
];
assert.ok(EXPECTED_SMALL_INT64.equals(i64types.SMALL_INT64));
@@ -47,27 +47,27 @@
assert.ok(EXPECTED_MIN_JS_SAFE_INT64.equals(i64types.MIN_JS_SAFE_INT64));
assert.ok(
EXPECTED_MAX_JS_SAFE_PLUS_ONE_INT64.equals(
- i64types.MAX_JS_SAFE_PLUS_ONE_INT64
- )
+ i64types.MAX_JS_SAFE_PLUS_ONE_INT64,
+ ),
);
assert.ok(
EXPECTED_MIN_JS_SAFE_MINUS_ONE_INT64.equals(
- i64types.MIN_JS_SAFE_MINUS_ONE_INT64
- )
+ i64types.MIN_JS_SAFE_MINUS_ONE_INT64,
+ ),
);
assert.ok(EXPECTED_MAX_SIGNED_INT64.equals(i64types.MAX_SIGNED_INT64));
assert.ok(EXPECTED_MIN_SIGNED_INT64.equals(i64types.MIN_SIGNED_INT64));
assert.equal(
EXPECTED_SMALL_INT64_AS_NUMBER,
- i64types.SMALL_INT64.toNumber()
+ i64types.SMALL_INT64.toNumber(),
);
assert.equal(
Number.MAX_SAFE_INTEGER,
- i64types.MAX_JS_SAFE_INT64.toNumber()
+ i64types.MAX_JS_SAFE_INT64.toNumber(),
);
assert.equal(
Number.MIN_SAFE_INTEGER,
- i64types.MIN_JS_SAFE_INT64.toNumber()
+ i64types.MIN_JS_SAFE_INT64.toNumber(),
);
for (let i = 0; i < EXPECTED_INT64_LIST.length; ++i) {
@@ -79,14 +79,14 @@
assert.ok(
i64types.INT64_2_INT64_MAP[
JSONInt64.toDecimalString(int64Object)
- ].equals(int64Object)
+ ].equals(int64Object),
);
}
assert.end();
- }
+ },
};
-Object.keys(cases).forEach(function(caseName) {
+Object.keys(cases).forEach(function (caseName) {
test(caseName, cases[caseName]);
});
diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js
index 677839a..c8e7808 100644
--- a/lib/nodejs/test/server.js
+++ b/lib/nodejs/test/server.js
@@ -29,12 +29,12 @@
.option(
"-p, --protocol <protocol>",
"Set thrift protocol (binary|compact|json)",
- "binary"
+ "binary",
)
.option(
"-t, --transport <transport>",
"Set thrift transport (buffered|framed|http)",
- "buffered"
+ "buffered",
)
.option("--ssl", "use ssl transport")
.option("--port <port>", "Set thrift server port", 9090)
@@ -42,7 +42,7 @@
.option(
"-t, --type <type>",
"Select server type (http|multiplex|tcp|websocket)",
- "tcp"
+ "tcp",
)
.option("--callback", "test with callback style functions")
.option("--es6", "Use es6 code")
@@ -68,7 +68,7 @@
let options = {
transport: helpers.transports[program.transport],
- protocol: helpers.protocols[program.protocol]
+ protocol: helpers.protocols[program.protocol],
};
if (type === "http" || type === "websocket") {
@@ -78,30 +78,30 @@
options = {
services: { "/test": options },
cors: {
- "*": true
- }
+ "*": true,
+ },
};
}
let processor;
if (type === "multiplex") {
const SecondServiceHandler = {
- secondtestString: function(thing, result) {
+ secondtestString: function (thing, result) {
console.log('testString("' + thing + '")');
result(null, 'testString("' + thing + '")');
- }
+ },
};
processor = new thrift.MultiplexedProcessor();
processor.registerProcessor(
"ThriftTest",
- new ThriftTest.Processor(ThriftTestHandler)
+ new ThriftTest.Processor(ThriftTestHandler),
);
processor.registerProcessor(
"SecondService",
- new SecondService.Processor(SecondServiceHandler)
+ new SecondService.Processor(SecondServiceHandler),
);
}
@@ -114,7 +114,7 @@
) {
options.tls = {
key: fs.readFileSync(path.resolve(__dirname, "server.key")),
- cert: fs.readFileSync(path.resolve(__dirname, "server.crt"))
+ cert: fs.readFileSync(path.resolve(__dirname, "server.crt")),
};
}
}
diff --git a/lib/nodejs/test/test-cases.js b/lib/nodejs/test/test-cases.js
index 02c566f..98077f7 100644
--- a/lib/nodejs/test/test-cases.js
+++ b/lib/nodejs/test/test-cases.js
@@ -65,9 +65,9 @@
a: "123",
"a b": "with spaces ",
same: "same",
- "0": "numeric key",
+ 0: "numeric key",
longValue: stringTest,
- stringTest: "long key"
+ stringTest: "long key",
});
const simple = [
@@ -93,9 +93,9 @@
["testI64", new Int64(new Buffer([0, 0x20, 0, 0, 0, 0, 0, 1]))], // 2^53+1
[
"testI64",
- new Int64(new Buffer([0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]))
+ new Int64(new Buffer([0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])),
], // -2^53-1
- ["testTypedef", 69]
+ ["testTypedef", 69],
];
const mapout = {};
@@ -106,21 +106,21 @@
const deep = [
[
"testList",
- [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
- ]
+ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
+ ],
];
const deepUnordered = [
["testMap", mapout],
["testSet", [1, 2, 3]],
- ["testStringMap", mapTestInput]
+ ["testStringMap", mapTestInput],
];
const out = new ttypes.Xtruct({
string_thing: "Zero",
byte_thing: 1,
i32_thing: -3,
- i64_thing: 1000000
+ i64_thing: 1000000,
});
const out2 = new ttypes.Xtruct2();
@@ -129,44 +129,44 @@
out2.i32_thing = 5;
const crazy = new ttypes.Insanity({
- userMap: { "5": 5, "8": 8 },
+ userMap: { 5: 5, 8: 8 },
xtructs: [
new ttypes.Xtruct({
string_thing: "Goodbye4",
byte_thing: 4,
i32_thing: 4,
- i64_thing: 4
+ i64_thing: 4,
}),
new ttypes.Xtruct({
string_thing: "Hello2",
byte_thing: 2,
i32_thing: 2,
- i64_thing: 2
- })
- ]
+ i64_thing: 2,
+ }),
+ ],
});
const crazy2 = new ttypes.Insanity({
- userMap: { "5": 5, "8": 8 },
+ userMap: { 5: 5, 8: 8 },
xtructs: [
{
string_thing: "Goodbye4",
byte_thing: 4,
i32_thing: 4,
- i64_thing: 4
+ i64_thing: 4,
},
{
string_thing: "Hello2",
byte_thing: 2,
i32_thing: 2,
- i64_thing: 2
- }
- ]
+ i64_thing: 2,
+ },
+ ],
});
const insanity = {
- "1": { "2": crazy, "3": crazy },
- "2": { "6": { userMap: {}, xtructs: [] } }
+ 1: { 2: crazy, 3: crazy },
+ 2: { 6: { userMap: {}, xtructs: [] } },
};
module.exports.simple = simple;
diff --git a/lib/nodejs/test/test_driver.js b/lib/nodejs/test/test_driver.js
index 7c9a919..0593aea 100644
--- a/lib/nodejs/test/test_driver.js
+++ b/lib/nodejs/test/test_driver.js
@@ -34,18 +34,18 @@
const Int64 = require("node-int64");
const testCases = require("./test-cases");
-exports.ThriftTestDriver = function(client, callback) {
+exports.ThriftTestDriver = function (client, callback) {
test(
"NodeJS Style Callback Client Tests",
{ skip: helpers.ecmaMode === "es6" },
- function(assert) {
+ function (assert) {
const checkRecursively = makeRecursiveCheck(assert);
function makeAsserter(assertionFn) {
- return function(c) {
+ return function (c) {
const fnName = c[0];
const expected = c[1];
- client[fnName](expected, function(err, actual) {
+ client[fnName](expected, function (err, actual) {
assert.error(err, fnName + ": no callback error");
assertionFn(actual, expected, fnName);
});
@@ -53,18 +53,18 @@
}
testCases.simple.forEach(
- makeAsserter(function(a, e, m) {
+ makeAsserter(function (a, e, m) {
if (a instanceof Int64) {
const e64 = e instanceof Int64 ? e : new Int64(e);
assert.deepEqual(a.buffer, e64.buffer, m);
} else {
assert.equal(a, e, m);
}
- })
+ }),
);
testCases.deep.forEach(makeAsserter(assert.deepEqual));
testCases.deepUnordered.forEach(
- makeAsserter(makeUnorderedDeepEqual(assert))
+ makeAsserter(makeUnorderedDeepEqual(assert)),
);
const arr = [];
@@ -72,106 +72,106 @@
arr[i] = 255 - i;
}
let buf = new Buffer(arr);
- client.testBinary(buf, function(err, response) {
+ client.testBinary(buf, function (err, response) {
assert.error(err, "testBinary: no callback error");
assert.equal(response.length, 256, "testBinary");
assert.deepEqual(response, buf, "testBinary(Buffer)");
});
buf = new Buffer(arr);
- client.testBinary(buf.toString("binary"), function(err, response) {
+ client.testBinary(buf.toString("binary"), function (err, response) {
assert.error(err, "testBinary: no callback error");
assert.equal(response.length, 256, "testBinary");
assert.deepEqual(response, buf, "testBinary(string)");
});
- client.testMapMap(42, function(err, response) {
+ client.testMapMap(42, function (err, response) {
const expected = {
- "4": { "1": 1, "2": 2, "3": 3, "4": 4 },
- "-4": { "-4": -4, "-3": -3, "-2": -2, "-1": -1 }
+ 4: { 1: 1, 2: 2, 3: 3, 4: 4 },
+ "-4": { "-4": -4, "-3": -3, "-2": -2, "-1": -1 },
};
assert.error(err, "testMapMap: no callback error");
assert.deepEqual(expected, response, "testMapMap");
});
- client.testStruct(testCases.out, function(err, response) {
+ client.testStruct(testCases.out, function (err, response) {
assert.error(err, "testStruct: no callback error");
checkRecursively(testCases.out, response, "testStruct");
});
- client.testNest(testCases.out2, function(err, response) {
+ client.testNest(testCases.out2, function (err, response) {
assert.error(err, "testNest: no callback error");
checkRecursively(testCases.out2, response, "testNest");
});
- client.testInsanity(testCases.crazy, function(err, response) {
+ client.testInsanity(testCases.crazy, function (err, response) {
assert.error(err, "testInsanity: no callback error");
checkRecursively(testCases.insanity, response, "testInsanity");
});
- client.testInsanity(testCases.crazy2, function(err, response) {
+ client.testInsanity(testCases.crazy2, function (err, response) {
assert.error(err, "testInsanity2: no callback error");
checkRecursively(testCases.insanity, response, "testInsanity2");
});
- client.testException("TException", function(err, response) {
+ client.testException("TException", function (err, response) {
assert.ok(
err instanceof TException,
- "testException: correct error type"
+ "testException: correct error type",
);
assert.ok(!response, "testException: no response");
});
- client.testException("Xception", function(err, response) {
+ client.testException("Xception", function (err, response) {
assert.ok(
err instanceof ttypes.Xception,
- "testException: correct error type"
+ "testException: correct error type",
);
assert.ok(!response, "testException: no response");
assert.equal(err.errorCode, 1001, "testException: correct error code");
assert.equal(
"Xception",
err.message,
- "testException: correct error message"
+ "testException: correct error message",
);
});
- client.testException("no Exception", function(err, response) {
+ client.testException("no Exception", function (err, response) {
assert.error(err, "testException: no callback error");
assert.ok(!response, "testException: no response");
});
- client.testOneway(0, function(err, response) {
+ client.testOneway(0, function (err, response) {
assert.error(err, "testOneway: no callback error");
assert.strictEqual(response, undefined, "testOneway: void response");
});
- checkOffByOne(function(done) {
- client.testI32(-1, function(err, response) {
+ checkOffByOne(function (done) {
+ client.testI32(-1, function (err, response) {
assert.error(err, "checkOffByOne: no callback error");
assert.equal(-1, response);
assert.end();
done();
});
}, callback);
- }
+ },
);
// ES6 does not support callback style
if (helpers.ecmaMode === "es6") {
- checkOffByOne(done => done(), callback);
+ checkOffByOne((done) => done(), callback);
}
};
-exports.ThriftTestDriverPromise = function(client, callback) {
- test("Promise Client Tests", function(assert) {
+exports.ThriftTestDriverPromise = function (client, callback) {
+ test("Promise Client Tests", function (assert) {
const checkRecursively = makeRecursiveCheck(assert);
function makeAsserter(assertionFn) {
- return function(c) {
+ return function (c) {
const fnName = c[0];
const expected = c[1];
client[fnName](expected)
- .then(function(actual) {
+ .then(function (actual) {
assertionFn(actual, expected, fnName);
})
.catch(() => assert.fail("fnName"));
@@ -179,63 +179,63 @@
}
testCases.simple.forEach(
- makeAsserter(function(a, e, m) {
+ makeAsserter(function (a, e, m) {
if (a instanceof Int64) {
const e64 = e instanceof Int64 ? e : new Int64(e);
assert.deepEqual(a.buffer, e64.buffer, m);
} else {
assert.equal(a, e, m);
}
- })
+ }),
);
testCases.deep.forEach(makeAsserter(assert.deepEqual));
testCases.deepUnordered.forEach(
- makeAsserter(makeUnorderedDeepEqual(assert))
+ makeAsserter(makeUnorderedDeepEqual(assert)),
);
client
.testStruct(testCases.out)
- .then(function(response) {
+ .then(function (response) {
checkRecursively(testCases.out, response, "testStruct");
})
.catch(() => assert.fail("testStruct"));
client
.testNest(testCases.out2)
- .then(function(response) {
+ .then(function (response) {
checkRecursively(testCases.out2, response, "testNest");
})
.catch(() => assert.fail("testNest"));
client
.testInsanity(testCases.crazy)
- .then(function(response) {
+ .then(function (response) {
checkRecursively(testCases.insanity, response, "testInsanity");
})
.catch(() => assert.fail("testInsanity"));
client
.testInsanity(testCases.crazy2)
- .then(function(response) {
+ .then(function (response) {
checkRecursively(testCases.insanity, response, "testInsanity2");
})
.catch(() => assert.fail("testInsanity2"));
client
.testException("TException")
- .then(function() {
+ .then(function () {
assert.fail("testException: TException");
})
- .catch(function(err) {
+ .catch(function (err) {
assert.ok(err instanceof TException);
});
client
.testException("Xception")
- .then(function() {
+ .then(function () {
assert.fail("testException: Xception");
})
- .catch(function(err) {
+ .catch(function (err) {
assert.ok(err instanceof ttypes.Xception);
assert.equal(err.errorCode, 1001);
assert.equal("Xception", err.message);
@@ -243,22 +243,22 @@
client
.testException("no Exception")
- .then(function(response) {
+ .then(function (response) {
assert.equal(undefined, response); //void
})
.catch(() => assert.fail("testException"));
client
.testOneway(0)
- .then(function(response) {
+ .then(function (response) {
assert.strictEqual(response, undefined, "testOneway: void response");
})
.catch(() => assert.fail("testOneway: should not reject"));
- checkOffByOne(function(done) {
+ checkOffByOne(function (done) {
client
.testI32(-1)
- .then(function(response) {
+ .then(function (response) {
assert.equal(-1, response);
assert.end();
done();
@@ -272,7 +272,7 @@
// =========================================================
function makeRecursiveCheck(assert) {
- return function(map1, map2, msg) {
+ return function (map1, map2, msg) {
const equal = checkRecursively(map1, map2);
assert.ok(equal, msg);
@@ -295,7 +295,7 @@
return map1 == map2;
}
} else {
- return Object.keys(map1).every(function(key) {
+ return Object.keys(map1).every(function (key) {
return checkRecursively(map1[key], map2[key]);
});
}
@@ -319,7 +319,7 @@
* Because this is the last test against the server, when it completes
* the entire suite is complete by definition (the tests run serially).
*/
- done(function() {
+ done(function () {
test_complete = true;
});
@@ -334,7 +334,7 @@
callback(
"Server test failed to complete after " +
(retry_limit * retry_interval) / 1000 +
- " seconds"
+ " seconds",
);
}
}
@@ -344,7 +344,7 @@
}
function makeUnorderedDeepEqual(assert) {
- return function(actual, expected, name) {
+ return function (actual, expected, name) {
assert.equal(actual.length, expected.length, name);
for (const k in actual) {
let found = false;
diff --git a/lib/nodejs/test/test_handler.js b/lib/nodejs/test/test_handler.js
index 317a7c8..a6a6fc2 100644
--- a/lib/nodejs/test/test_handler.js
+++ b/lib/nodejs/test/test_handler.js
@@ -24,7 +24,7 @@
const TException = require("thrift").Thrift.TException;
function makeSyncHandler() {
- return function(thing) {
+ return function (thing) {
return thing;
};
}
@@ -36,11 +36,11 @@
testMulti: testMulti,
testException: testException,
testMultiException: testMultiException,
- testOneway: testOneway
+ testOneway: testOneway,
};
function makeAsyncHandler(label) {
- return function(thing, result) {
+ return function (thing, result) {
thing = syncHandlers[label](thing);
result(null, thing);
};
@@ -51,7 +51,7 @@
testMulti: testMultiAsync,
testException: testExceptionAsync,
testMultiException: testMultiExceptionAsync,
- testOneway: testOnewayAsync
+ testOneway: testOnewayAsync,
};
const identityHandlers = [
@@ -69,7 +69,7 @@
"testSet",
"testList",
"testEnum",
- "testTypedef"
+ "testTypedef",
];
function testVoid() {
@@ -208,12 +208,12 @@
testOneway(sleepFor);
}
-identityHandlers.forEach(function(label) {
+identityHandlers.forEach(function (label) {
syncHandlers[label] = makeSyncHandler(label);
asyncHandlers[label] = makeAsyncHandler(label);
});
-["testMapMap", "testInsanity"].forEach(function(label) {
+["testMapMap", "testInsanity"].forEach(function (label) {
asyncHandlers[label] = makeAsyncHandler(label);
});