Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SourceControlProvider.test.ts

27 lines1.0 KB

1import { assert, it } from "@effect/vitest";
2​
3import {
4 repositoryPathFromRemoteUrl,
5 transportSafeSourceControlErrorValue,
6} from "./SourceControlProvider.ts";
7​
8it("removes URL credentials, query parameters, and fragments from error transport values", () => {
9 assert.strictEqual(
10 transportSafeSourceControlErrorValue(
11 "https://user:secret@example.test/org/repo/pull/42?token=secret#discussion",
12 ),
13 "https://example.test/org/repo/pull/42",
14 );
15});
16​
17it.each([
18 ["git@github.com:T3Tools/t3code.git", "T3Tools/t3code"],
19 ["github.com:T3Tools/t3code.git", "T3Tools/t3code"],
20 ["gitlab.com:T3Tools/platform/t3code", "T3Tools/platform/t3code"],
21 ["https://github.com/T3Tools/t3code.git", "T3Tools/t3code"],
22 ["https://github.com/T3Tools/t3code.git?view=compact", "T3Tools/t3code"],
23 ["https://github.com/T3Tools/t3code.git#section", "T3Tools/t3code"],
24 ["C:/repos/t3code", null],
25])("reads the repository path of %s", (remoteUrl, expected) => {
26 assert.strictEqual(repositoryPathFromRemoteUrl(remoteUrl), expected);
27});