Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds tests to cover getting a CI source out of the CI source chooser #132

Merged
merged 3 commits into from
Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

// Add your own contribution below

### 0.11.0
### 0.11.0 - 0.11.2

* Add support for [Docker Cloud](https://cloud.docker.com)
* Add support for [Docker Cloud](https://cloud.docker.com) - camacho

### 0.10.1

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "danger",
"version": "0.11.0",
"version": "0.11.1",
"description": "Unit tests for Team Culture",
"main": "distribution/danger.js",
"typings": "distribution/danger.d.ts",
Expand Down Expand Up @@ -75,7 +75,7 @@
"@types/commander": "^2.3.31",
"@types/debug": "0.0.29",
"@types/es6-promise": "0.0.32",
"@types/jest": "^18.0.0",
"@types/jest": "^18.1.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"@types/node-fetch": "^1.6.6",
"babel-cli": "^6.16.0",
"babel-plugin-syntax-async-functions": "^6.13.0",
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions source/ci_source/providers/_tests/_circle.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Circle} from "../Circle"
import {getCISourceForEnv} from "../../get_ci_source"

const correctEnv = {
"CIRCLE_CI_API_TOKEN": "xxx",
Expand All @@ -9,6 +10,13 @@ const correctEnv = {
"CI_PULL_REQUEST": "https://github.com/artsy/eigen/pull/800"
}

describe("being found when looking for CI", () => {
it("finds Circle with the right ENV", () => {
const ci = getCISourceForEnv(correctEnv)
expect(ci).toBeInstanceOf(Circle)
})
})

describe(".isCI", () => {
it("validates when all Circle environment vars are set", () => {
const circle = new Circle(correctEnv)
Expand Down
8 changes: 8 additions & 0 deletions source/ci_source/providers/_tests/_dockerCloud.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import {DockerCloud} from "../DockerCloud"
import {getCISourceForEnv} from "../../get_ci_source"

const correctEnv = {
"DOCKER_REPO": "someproject",
"PULL_REQUEST_URL": "https://github.com/artsy/eigen/pull/800",
"SOURCE_REPOSITORY_URL": "https://github.com/artsy/eigen"
}

describe("being found when looking for CI", () => {
it("finds DockerCloud with the right ENV", () => {
const ci = getCISourceForEnv(correctEnv)
expect(ci).toBeInstanceOf(DockerCloud)
})
})

describe(".isCI", () => {
it("validates when all DockerCloud environment vars are set", () => {
const dockerCloud = new DockerCloud(correctEnv)
Expand Down
8 changes: 8 additions & 0 deletions source/ci_source/providers/_tests/_jenkins.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import {Jenkins} from "../Jenkins"
import {getCISourceForEnv} from "../../get_ci_source"

const correctEnv = {
"ghprbGhRepository": "danger/danger-js",
"ghprbPullId": "50",
"JENKINS_URL": "https://danger.jenkins"
}

describe("being found when looking for CI", () => {
it("finds Jenkins with the right ENV", () => {
const ci = getCISourceForEnv(correctEnv)
expect(ci).toBeInstanceOf(Jenkins)
})
})

describe(".isCI", () => {
it("validates when JENKINS_URL is present in environment", () => {
const jenkins = new Jenkins(correctEnv)
Expand Down
8 changes: 8 additions & 0 deletions source/ci_source/providers/_tests/_semaphore.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import {Semaphore} from "../Semaphore"
import {getCISourceForEnv} from "../../get_ci_source"

const correctEnv = {
"SEMAPHORE": "Yep",
"SEMAPHORE_REPO_SLUG": "artsy/eigen",
"PULL_REQUEST_NUMBER": "800"
}

describe("being found when looking for CI", () => {
it("finds Semaphore with the right ENV", () => {
const ci = getCISourceForEnv(correctEnv)
expect(ci).toBeInstanceOf(Semaphore)
})
})

describe(".isCI", () => {
test("validates when all Semaphore environment vars are set", () => {
const semaphore = new Semaphore(correctEnv)
Expand Down
8 changes: 8 additions & 0 deletions source/ci_source/providers/_tests/_travis.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import {Travis} from "../Travis"
import {getCISourceForEnv} from "../../get_ci_source"

const correctEnv = {
"HAS_JOSH_K_SEAL_OF_APPROVAL": "true",
"TRAVIS_PULL_REQUEST": "800",
"TRAVIS_REPO_SLUG": "artsy/eigen"
}

describe("being found when looking for CI", () => {
it("finds Travis with the right ENV", () => {
const ci = getCISourceForEnv(correctEnv)
expect(ci).toBeInstanceOf(Travis)
})
})

describe(".isCI", () => {
test("validates when all Travis environment vars are set and Josh K says so", () => {
const travis = new Travis(correctEnv)
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/es6-promise/-/es6-promise-0.0.32.tgz#3bcf44fb1e429f3df76188c8c6d874463ba371fd"

"@types/jest@^18.0.0":
version "18.0.0"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-18.0.0.tgz#c0cfc76c426b4ef5cdad464870cd9b4b081eea29"
"@types/jest@^18.1.0":
version "18.1.0"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-18.1.0.tgz#ed18f4c75b3d76de966f543fb6e3bad77d3caa17"

"@types/node-fetch@^1.6.6":
version "1.6.7"
Expand Down