-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
1 parent
6c49cfe
commit dafdb02
Showing
2 changed files
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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", | ||
// DANGER_GITLAB_API_TOKEN: "gitlab_dummy_a829-07bd7559eecb" | ||
} | ||
|
||
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() | ||
}) | ||
}) | ||
|
||
// missed | ||
|
||
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 the PR Url", () => { | ||
const result = new GitLabCI(correctEnv) | ||
expect(result.repoSlug).toEqual("gitlab-org/gitlab-foss") | ||
}) | ||
}) |