Test for ExtractURI

This commit is contained in:
David Tomaschik 2024-10-28 11:48:57 -07:00
parent e86bdd960c
commit e3d6483ab5
3 changed files with 38 additions and 0 deletions

View file

@ -64,6 +64,7 @@ import "./tests/ELFInfo.mjs";
import "./tests/Enigma.mjs";
import "./tests/ExtractEmailAddresses.mjs";
import "./tests/ExtractHashes.mjs";
import "./tests/ExtractURI.mjs";
import "./tests/Float.mjs";
import "./tests/FileTree.mjs";
import "./tests/FletcherChecksum.mjs";

View file

@ -0,0 +1,36 @@
/**
* Extract URI Tests
*
* @author David Tomaschik [dwt@google.com]
* @copyright Google LLC 2024
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Extract URI: Test",
input: "http://www.example.org:9999/path?foo=bar&baz=1&baz=2#frob",
expectedOutput: JSON.stringify({
"protocol": "http:",
"hostname": "www.example.org",
"port": "9999",
"pathname": "/path",
"hash": "#frob",
"query": {
"foo": "bar",
"baz": [
"1",
"2"
]
}
}, null, 4),
recipeConfig: [
{
"op": "Extract URI",
"args": [],
}
]
}
]);