mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-06-28 05:33:47 +00:00
feat: integrate with codeberg (#80)
This commit is contained in:
parent
eecbff34b7
commit
9f0fbc0b2f
11 changed files with 72 additions and 25 deletions
|
@ -20,6 +20,11 @@ describe("git client factory test", () => {
|
|||
expect(client).toBeInstanceOf(GitLabClient);
|
||||
});
|
||||
|
||||
test("correctly create codeberg client", () => {
|
||||
const client = GitClientFactory.getOrCreate(GitClientType.CODEBERG, "auth", "apiurl");
|
||||
expect(client).toBeInstanceOf(GitHubClient);
|
||||
});
|
||||
|
||||
test("check get service github", () => {
|
||||
const create = GitClientFactory.getOrCreate(GitClientType.GITHUB, "auth", "apiurl");
|
||||
const get = GitClientFactory.getClient();
|
||||
|
@ -31,4 +36,10 @@ describe("git client factory test", () => {
|
|||
const get = GitClientFactory.getClient();
|
||||
expect(create).toStrictEqual(get);
|
||||
});
|
||||
|
||||
test("check get service codeberg", () => {
|
||||
const create = GitClientFactory.getOrCreate(GitClientType.CODEBERG, "auth", "apiurl");
|
||||
const get = GitClientFactory.getClient();
|
||||
expect(create).toStrictEqual(get);
|
||||
});
|
||||
});
|
|
@ -23,6 +23,18 @@ describe("check git utilities", () => {
|
|||
expect(inferGitApiUrl("http://github.acme-inc.com/superuser/backporting-example/pull/4", "v3")).toStrictEqual("http://github.acme-inc.com/api/v3");
|
||||
});
|
||||
|
||||
test("check infer github api from github api url", ()=> {
|
||||
expect(inferGitApiUrl("https://api.github.com/repos/owner/repo/pulls/1")).toStrictEqual("https://api.github.com");
|
||||
});
|
||||
|
||||
test("check infer codeberg api", ()=> {
|
||||
expect(inferGitApiUrl("https://codeberg.org/lampajr/backporting-example/pulls/1", "v1")).toStrictEqual("https://codeberg.org/api/v1");
|
||||
});
|
||||
|
||||
test("check infer codeberg api", ()=> {
|
||||
expect(inferGitApiUrl("https://codeberg.org/lampajr/backporting-example/pulls/1", undefined)).toStrictEqual("https://codeberg.org/api/v4");
|
||||
});
|
||||
|
||||
test("check infer github client", ()=> {
|
||||
expect(inferGitClient("https://github.com/superuser/backporting-example/pull/4")).toStrictEqual(GitClientType.GITHUB);
|
||||
});
|
||||
|
@ -39,7 +51,7 @@ describe("check git utilities", () => {
|
|||
expect(inferGitClient("https://api.github.com/repos/owner/repo/pulls/1")).toStrictEqual(GitClientType.GITHUB);
|
||||
});
|
||||
|
||||
test("check infer github api from github api url", ()=> {
|
||||
expect(inferGitApiUrl("https://api.github.com/repos/owner/repo/pulls/1")).toStrictEqual("https://api.github.com");
|
||||
test("check infer codeberg client", ()=> {
|
||||
expect(inferGitClient("https://codeberg.org/lampajr/backporting-example/pulls/1")).toStrictEqual(GitClientType.CODEBERG);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue