Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
78 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { GitLabCI } from "../GitLabCI" | ||
import { getCISourceForEnv } from "../../get_ci_source" | ||
|
||
const correctEnv = { | ||
GITLAB_CI: "true", | ||
CI_MERGE_REQUEST_IID: "27117", | ||
CI_PROJECT_PATH: "gitlab-org/gitlab-foss", | ||
} | ||
|
||
describe("being found when looking for CI", () => { | ||
it("finds GitLab with the right ENV", () => { | ||
const ci = getCISourceForEnv(correctEnv) | ||
expect(ci).toBeInstanceOf(GitLabCI) | ||
}) | ||
}) | ||
|
||
describe(".isCI", () => { | ||
it("validates when all GitLab environment vars are set", async () => { | ||
const result = new GitLabCI(correctEnv) | ||
expect(result.isCI).toBeTruthy() | ||
}) | ||
|
||
it("does not validate without env", async () => { | ||
const result = new GitLabCI({}) | ||
expect(result.isCI).toBeFalsy() | ||
}) | ||
}) | ||
|
||
describe(".pullRequestID", () => { | ||
it("pulls it out of the env", () => { | ||
const result = new GitLabCI(correctEnv) | ||
expect(result.pullRequestID).toEqual("27117") | ||
}) | ||
}) | ||
|
||
describe(".repoSlug", () => { | ||
it("derives it from 'CI_PROJECT_PATH' env var", () => { | ||
const result = new GitLabCI(correctEnv) | ||
expect(result.repoSlug).toEqual("gitlab-org/gitlab-foss") | ||
}) | ||
|
||
it("derives it form 'CI_MERGE_REQUEST_PROJECT_PATH' env var if set", () => { | ||
correctEnv["CI_MERGE_REQUEST_PROJECT_PATH"] = "gitlab-org/release-tools" | ||
const result = new GitLabCI(correctEnv) | ||
expect(result.repoSlug).toEqual("gitlab-org/release-tools") | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters