Throw ExcludedOperationError when excluded operation is called from API

This commit is contained in:
d98762625 2018-08-31 14:43:14 +01:00
parent 7c9ebafd00
commit 96d5930f05
6 changed files with 143 additions and 8 deletions

View file

@ -318,4 +318,22 @@ TestRegister.addApiTests([
assert.strictEqual(JSONDish.type, 6);
}),
it("Excluded operations: throw a sensible error when you try and call one", () => {
try {
chef.fork();
} catch (e) {
assert.strictEqual(e.type, "ExcludedOperationError");
assert.strictEqual(e.message, "Sorry, the Fork operation is not available in the Node.js version of CyberChef.");
}
}),
it("Excluded operations: throw a sensible error when you try and call one", () => {
try {
chef.renderImage();
} catch (e) {
assert.strictEqual(e.type, "ExcludedOperationError");
assert.strictEqual(e.message, "Sorry, the RenderImage operation is not available in the Node.js version of CyberChef.");
}
})
]);