mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 18:10:39 +09:00
Support GitHub shorthand refs for company import
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
5a73556871
commit
e6df9fa078
6 changed files with 215 additions and 9 deletions
|
|
@ -87,7 +87,7 @@ vi.mock("../routes/org-chart-svg.js", () => ({
|
|||
renderOrgChartPng: vi.fn(async () => Buffer.from("png")),
|
||||
}));
|
||||
|
||||
const { companyPortabilityService } = await import("../services/company-portability.js");
|
||||
const { companyPortabilityService, parseGitHubSourceUrl } = await import("../services/company-portability.js");
|
||||
|
||||
function asTextFile(entry: CompanyPortabilityFileEntry | undefined) {
|
||||
expect(typeof entry).toBe("string");
|
||||
|
|
@ -301,6 +301,32 @@ describe("company portability", () => {
|
|||
}));
|
||||
});
|
||||
|
||||
it("parses canonical GitHub import URLs with explicit ref and package path", () => {
|
||||
expect(
|
||||
parseGitHubSourceUrl("https://github.com/paperclipai/companies?ref=feature%2Fdemo&path=gstack"),
|
||||
).toEqual({
|
||||
owner: "paperclipai",
|
||||
repo: "companies",
|
||||
ref: "feature/demo",
|
||||
basePath: "gstack",
|
||||
companyPath: "gstack/COMPANY.md",
|
||||
});
|
||||
});
|
||||
|
||||
it("parses canonical GitHub import URLs with explicit companyPath", () => {
|
||||
expect(
|
||||
parseGitHubSourceUrl(
|
||||
"https://github.com/paperclipai/companies?ref=abc123&companyPath=gstack%2FCOMPANY.md",
|
||||
),
|
||||
).toEqual({
|
||||
owner: "paperclipai",
|
||||
repo: "companies",
|
||||
ref: "abc123",
|
||||
basePath: "gstack",
|
||||
companyPath: "gstack/COMPANY.md",
|
||||
});
|
||||
});
|
||||
|
||||
it("exports referenced skills as stubs by default with sanitized Paperclip extension data", async () => {
|
||||
const portability = companyPortabilityService({} as any);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue