Files
bun.sh/test/cli/install/hosted-git-info/from-url.test.ts
Marko Vejnovic 1d728bb778 feat(ENG-21324): Implement hosted_git_info.zig (#24138)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
2025-10-29 19:29:04 -07:00

32 lines
1.2 KiB
TypeScript

import { hostedGitInfo } from "bun:internal-for-testing";
import { describe, expect, it } from "bun:test";
import { invalidGitUrls, validGitUrls } from "./cases";
describe("fromUrl", () => {
describe("valid urls", () => {
describe.each(Object.entries(validGitUrls))("%s", (_, urlset: object) => {
it.each(Object.entries(urlset))("parses %s", (url, expected) => {
expect(hostedGitInfo.fromUrl(url)).toMatchObject({
...(expected.type && { type: expected.type }),
...(expected.domain && { domain: expected.domain }),
...(expected.user && { user: expected.user }),
...(expected.project && { project: expected.project }),
...(expected.committish && { committish: expected.committish }),
...(expected.default && { default: expected.default }),
});
});
});
});
// TODO(markovejnovic): Unskip these tests.
describe.skip("invalid urls", () => {
describe.each(Object.entries(invalidGitUrls))("%s", (_, urls: (string | null | undefined)[]) => {
it.each(urls)("does not permit %s", url => {
expect(() => {
hostedGitInfo.fromUrl(url);
}).toThrow();
});
});
});
});