mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 15:33:12 +09:00
Fix misc problems detected by ESLint
Reformat and clean up issues detected by ESLint.
This commit is contained in:
1 parent
8cb21c5fa8
commit
e9f5cae4f0
34 files changed
+132
-189
No files matched your search
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in new issue
Block a user