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: [], + }, + ], + }, +]);