mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 09:07:46 +02:00
Restack the OAuth backend from PR #5584 onto current master for PAP-9233, preserving the provider registry, OAuth routes, refresh worker, resolver integration, tests, and docs. Co-Authored-By: Paperclip <noreply@paperclip.ing>
15 lines
787 B
TypeScript
15 lines
787 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { getByPath } from "../dot-path.js";
|
|
|
|
describe("getByPath", () => {
|
|
it("reads top-level field", () => expect(getByPath({ id: 1 }, "id")).toBe(1));
|
|
it("reads nested field", () => expect(getByPath({ team: { id: "abc" } }, "team.id")).toBe("abc"));
|
|
it("returns null for missing nested", () => expect(getByPath({ a: {} }, "a.b.c")).toBeNull());
|
|
it("returns null for null intermediates", () => expect(getByPath({ a: null }, "a.b")).toBeNull());
|
|
it("returns null for non-object root", () => expect(getByPath(null as unknown, "a.b")).toBeNull());
|
|
it("ignores prototype pollution paths", () => {
|
|
expect(getByPath({}, "__proto__.polluted")).toBeNull();
|
|
expect(getByPath({}, "constructor.prototype")).toBeNull();
|
|
});
|
|
});
|