Skip to content

Commit

Permalink
Test for ExtractURI
Browse files Browse the repository at this point in the history
  • Loading branch information
Matir committed Oct 28, 2024
1 parent e86bdd9 commit e3d6483
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/config/Categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
"Parse UDP",
"Parse SSH Host Key",
"Parse URI",
"Extract URI",
"URL Encode",
"URL Decode",
"Protobuf Decode",
Expand Down
1 change: 1 addition & 0 deletions tests/operations/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
36 changes: 36 additions & 0 deletions tests/operations/tests/ExtractURI.mjs
Original file line number Diff line number Diff line change
@@ -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": [],
}
]
}
]);

0 comments on commit e3d6483

Please sign in to comment.