Move response filters into Rust (#755)

This commit is contained in:
Gregory Schier authored and GitHub committed 2026-10-15 06:22:23 -07:00
1 parent 19908b1902
commit 9b3715024d
42 files changed
+15538 -399

No files matched your search

@@ -107,6 +107,29 @@ describe("segmentsToJsonPath", () => {
});
describe("jsonPathToSegments", () => {
// The filter side of these keys is tested in crates/yaak-filter.
test.each([
"identifier",
"a.b",
"space key",
"",
'quote"key',
"back\\slash",
"combined\"\\]'key",
"*",
"$",
"$foo",
"?(true)",
"line\nbreak\t\u0000",
"emoji 🤔",
"__proto__",
])("round-trips the caret path to the literal key %j", (key) => {
const doc = JSON.stringify({ [key]: "needle-value", decoy: "wrong-value" }, null, 2);
const segments = jsonPathSegmentsAt(stateFor(doc), doc.indexOf('"needle-value"') + 4);
expect(segments).toEqual([{ kind: "key", key }]);
expect(jsonPathToSegments(segmentsToJsonPath(segments ?? []))).toEqual(segments);
});
test("round-trips paths built by segmentsToJsonPath", () => {
for (const path of ["$", "$[0]", "$[0].id", '$.data["user.name"][12]', '$["say \\"hi\\""]']) {
const segments = jsonPathToSegments(path);