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:
Hornwitser committed 2020-03-22 02:10:54 +01:00
1 parent 941ceab935
commit 808bd6b453
2 files changed
+22 -2

No files matched your search

+8 -2
View File
@@ -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() {