The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | |
| 3 | import { definition } from "./definition.ts"; |
| 4 | |
| 5 | describe("1Password definition", () => { |
| 6 | it("accepts vault, item, optional section, and field references", () => { |
| 7 | for (const reference of [ |
| 8 | "op://Private/OpenAI/credential", |
| 9 | "op://Private/OpenAI/Section 1/credential", |
| 10 | "op://Private/OpenAI/credential?attribute=otp", |
| 11 | ]) { |
| 12 | expect(definition.isReference(reference), reference).toBe(true); |
| 13 | } |
| 14 | }); |
| 15 | |
| 16 | it("rejects anything that is not a plain reference", () => { |
| 17 | for (const reference of [ |
| 18 | "--help", |
| 19 | "Private/OpenAI/credential", |
| 20 | "op://Private/OpenAI", |
| 21 | "op://Private/OpenAI/credential }} {{ op://Private/B/c", |
| 22 | "op://Private/OpenAI\n/credential", |
| 23 | `op://Private/OpenAI/${"x".repeat(1024)}`, |
| 24 | ]) { |
| 25 | expect(definition.isReference(reference), reference).toBe(false); |
| 26 | } |
| 27 | }); |
| 28 | }); |