From 031b0f5317f6fe9c45ccbd156edad5a061bdaa96 Mon Sep 17 00:00:00 2001 From: n1073645 Date: Fri, 17 Apr 2020 14:37:08 +0100 Subject: [PATCH] XML Validator Tests --- tests/operations/index.mjs | 1 + tests/operations/tests/XMLValidator.mjs | 32 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/operations/tests/XMLValidator.mjs diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index 8d3cd623..ac99cdb6 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -101,6 +101,7 @@ import "./tests/LuhnChecksum.mjs"; import "./tests/CipherSaber2.mjs"; import "./tests/Colossus.mjs"; import "./tests/ParseObjectIDTimestamp.mjs"; +import "./tests/XMLValidator.mjs"; // Cannot test operations that use the File type yet diff --git a/tests/operations/tests/XMLValidator.mjs b/tests/operations/tests/XMLValidator.mjs new file mode 100644 index 00000000..e3c2466f --- /dev/null +++ b/tests/operations/tests/XMLValidator.mjs @@ -0,0 +1,32 @@ +/** + * @author n1073645 [n1073645@gmail.com] + * @copyright Crown Copyright 2020 + * @license Apache-2.0 + */ + +import TestRegister from "../../lib/TestRegister.mjs"; + +TestRegister.addTests([ + { + name: "XML Validator, valid XML", + input: "Learning XMLErik T. Ray200339.95", + expectedOutput: "Learning XMLErik T. Ray200339.95", + recipeConfig: [ + { + op: "XML Validator", + args: [], + }, + ], + }, + { + name: "XML Validator, invalid XML", + input: "Learning XMLErik T. Ray200339.95", + expectedOutput: "Error: [xmldom error] element parse error: Error: [xmldom warning] attribute space is required\"category\"!!\n@#[line:undefined,col:undefined]\n@#[line:undefined,col:undefined]", + recipeConfig: [ + { + op: "XML Validator", + args: [], + }, + ], + }, +]);