Fix misc problems detected by ESLint

Reformat and clean up issues detected by ESLint.
This commit is contained in:
Hornwitser committed 2020-06-17 20:59:37 +02:00
1 parent 8cb21c5fa8
commit e9f5cae4f0
34 files changed
+132 -189

No files matched your search

+1 -1
View File
@@ -81,7 +81,7 @@ describe("lib/link/connectors", function() {
describe(".processHandshake()", function() {
it("should close on invalid message", function() {
testConnector._socket.closeCalled = false;
testConnector._processHandshake({ data: "invalid message" }),
testConnector._processHandshake({ data: "invalid message" });
assert(testConnector._socket.closeCalled, "Close was not called on the socket");
});
it("should call register on hello", function() {
+1 -1
View File
@@ -56,7 +56,7 @@ describe("lib/link/link", function() {
);
});
it("should set the handler", function() {
let handler = (message) => {};
function handler(message) { }
testLink.setHandler("handler_test", handler, (message) => true);
assert.equal(testLink._handlers.get("handler_test"), handler);
});
+3 -7
View File
@@ -45,7 +45,7 @@ describe("lib/link/messages", function() {
let handlerResult;
it("should attach handler to a target link", function() {
testRequest.attach(testTargetLink, async (message) => handlerResult );
testRequest.attach(testTargetLink, async (message) => handlerResult);
assert(testTargetLink._handlers.has("test_request"), "Handler was not set");
});
it("should send result of calling the handler", async function() {
@@ -83,9 +83,7 @@ describe("lib/link/messages", function() {
testSourceLink.connector.send = (type, data) => {
request = { type, data };
};
testSourceLink.waitFor = (type, condition) => {
return { data: { type, request }};
};
testSourceLink.waitFor = (type, condition) => ({ data: { type, request }});
assert.deepEqual(
await testRequest.send(testSourceLink, { test: "request" }),
{ type: "test_response", request: { type: "test_request", data: { test: "request" }}}
@@ -94,9 +92,7 @@ describe("lib/link/messages", function() {
delete testSourceLink.waitFor;
});
it("should throw error response", async function() {
testSourceLink.waitFor = (type, condition) => {
return { data: { error: "test error" }};
};
testSourceLink.waitFor = (type, condition) => ({ data: { error: "test error" }});
await assert.rejects(
testRequest.send(testSourceLink, { test: "blah" }),
new errors.RequestError("test error")