mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 15:30:41 +09:00
Validate messages sent
Validate messages sent over links with the json schema provided from them. This aids debugging as an exception will be thrown from the code sending the bad content.
This commit is contained in:
1 parent
941ceab935
commit
808bd6b453
2 files changed
+22
-2
No files matched your search
@@ -16,6 +16,9 @@ describe("lib/link/messages", function() {
|
||||
let testRequest = new link.Request({
|
||||
type: 'test',
|
||||
links: ['source-target'],
|
||||
requestProperties: {
|
||||
"test": { type: "string" },
|
||||
},
|
||||
});
|
||||
|
||||
describe("constructor", function() {
|
||||
@@ -93,8 +96,8 @@ describe("lib/link/messages", function() {
|
||||
testSourceLink.waitFor = (type, condition) => {
|
||||
return { data: { error: "test error" }};
|
||||
};
|
||||
assert.rejects(
|
||||
testRequest.send(testSourceLink),
|
||||
await assert.rejects(
|
||||
testRequest.send(testSourceLink, { test: "blah" }),
|
||||
new errors.RequestError("test error")
|
||||
);
|
||||
delete testSourceLink.waitFor;
|
||||
@@ -106,6 +109,9 @@ describe("lib/link/messages", function() {
|
||||
let testEvent = new link.Event({
|
||||
type: 'test',
|
||||
links: ['source-target'],
|
||||
eventProperties: {
|
||||
"test": { type: "string" },
|
||||
},
|
||||
});
|
||||
|
||||
describe("constructor", function() {
|
||||
|
||||
Reference in new issue
Block a user