mirror of
https://github.com/gchq/CyberChef.git
synced 2025-07-01 10:22:19 -04:00
XML Validator Tests
This commit is contained in:
parent
2e28a4d737
commit
031b0f5317
2 changed files with 33 additions and 0 deletions
|
@ -101,6 +101,7 @@ import "./tests/LuhnChecksum.mjs";
|
||||||
import "./tests/CipherSaber2.mjs";
|
import "./tests/CipherSaber2.mjs";
|
||||||
import "./tests/Colossus.mjs";
|
import "./tests/Colossus.mjs";
|
||||||
import "./tests/ParseObjectIDTimestamp.mjs";
|
import "./tests/ParseObjectIDTimestamp.mjs";
|
||||||
|
import "./tests/XMLValidator.mjs";
|
||||||
|
|
||||||
|
|
||||||
// Cannot test operations that use the File type yet
|
// Cannot test operations that use the File type yet
|
||||||
|
|
32
tests/operations/tests/XMLValidator.mjs
Normal file
32
tests/operations/tests/XMLValidator.mjs
Normal file
|
@ -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: "<bookstore><book category=\"WEB\"><title lang=\"en\">Learning XML</title><author>Erik T. Ray</author><year>2003</year><price>39.95</price></book></bookstore>",
|
||||||
|
expectedOutput: "<bookstore><book category=\"WEB\"><title lang=\"en\">Learning XML</title><author>Erik T. Ray</author><year>2003</year><price>39.95</price></book></bookstore>",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "XML Validator",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "XML Validator, invalid XML",
|
||||||
|
input: "<bookstore><book category=\"WE><title lang=\"en\">Learning XML</title><author>Erik T. Ray</author><year>2003</year><price>39.95</price></book></bookstore>",
|
||||||
|
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: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
Loading…
Add table
Add a link
Reference in a new issue