| 1 | import { assert, it } from "@effect/vitest"; |
| 2 | |
| 3 | import { transportSafeSourceControlErrorValue } from "./SourceControlProvider.ts"; |
| 4 | |
| 5 | it("removes URL credentials, query parameters, and fragments from error transport values", () => { |
| 6 | assert.strictEqual( |
| 7 | transportSafeSourceControlErrorValue( |
| 8 | "https://user:secret@example.test/org/repo/pull/42?token=secret#discussion", |
| 9 | ), |
| 10 | "https://example.test/org/repo/pull/42", |
| 11 | ); |
| 12 | }); |
| 13 | |
| 14 | it("normalizes control characters and bounds error transport values", () => { |
| 15 | assert.strictEqual( |
| 16 | transportSafeSourceControlErrorValue(` owner/repo\n\t${"x".repeat(300)} `), |
| 17 | `owner/repo ${"x".repeat(245)}`, |
| 18 | ); |
| 19 | }); |