Files
PaperClipAI/server/src/oauth/__tests__/dot-path.test.ts
T
DottaandPaperclip 382cb3bede feat(oauth): restack OAuth backbone
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>
2026-05-12 09:47:09 -05:00

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();
});
});