mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
32 lines
1.2 KiB
TypeScript
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();
|
|
});
|
|
});
|
|
});
|
|
});
|