-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement additional deploy params
The following parameters are added to the deploy function. * force: removes required contexts * task: changes a task
- Loading branch information
Showing
4 changed files
with
128 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import * as factory from "./factory"; | ||
import { deploy } from "../src/deploy"; | ||
import Octokit from "@octokit/rest"; | ||
|
||
describe("deploy", () => { | ||
jest.setTimeout(30000); | ||
let probot: factory.Probot; | ||
|
||
afterEach(() => { | ||
factory.cleanAll(); | ||
factory.store.clear(); | ||
}); | ||
|
||
beforeEach(() => { | ||
probot = factory.probot(); | ||
factory.token(); | ||
factory.permission({ admin: true }); | ||
factory.repo().persist(); | ||
factory.gitCommit().persist(); | ||
factory.gitRef().persist(); | ||
}); | ||
|
||
test("creates a deployment", async () => { | ||
const isDeployed = factory.deploy({ | ||
ref: "refs/heads/featureA", | ||
task: "deploy", | ||
transient_environment: false, | ||
production_environment: true, | ||
environment: "production", | ||
auto_merge: true, | ||
required_contexts: ["continuous-integration/travis-ci/push"], | ||
description: "A test environment based on Docker", | ||
payload: { target: "production" } | ||
}); | ||
factory.config({ valid: true }); | ||
|
||
const github = new Octokit({ auth: "test" }); | ||
|
||
await deploy(github, probot.logger, factory.store, { | ||
owner: "Codertocat", | ||
repo: "Hello-World", | ||
ref: "refs/heads/featureA", | ||
sha: "0000000000000000000000000000000000000000", | ||
target: "production" | ||
}); | ||
expect(isDeployed.isDone()).toBe(true); | ||
}); | ||
|
||
test("creates a deployment with a task", async () => { | ||
const isDeployed = factory.deploy({ | ||
ref: "refs/heads/featureA", | ||
task: "foobar", | ||
transient_environment: false, | ||
production_environment: true, | ||
environment: "production", | ||
auto_merge: true, | ||
required_contexts: ["continuous-integration/travis-ci/push"], | ||
description: "A test environment based on Docker", | ||
payload: { target: "production" } | ||
}); | ||
factory.config({ valid: true }); | ||
|
||
const github = new Octokit({ auth: "test" }); | ||
|
||
await deploy(github, probot.logger, factory.store, { | ||
owner: "Codertocat", | ||
repo: "Hello-World", | ||
ref: "refs/heads/featureA", | ||
sha: "0000000000000000000000000000000000000000", | ||
target: "production", | ||
task: "foobar" | ||
}); | ||
expect(isDeployed.isDone()).toBe(true); | ||
}); | ||
|
||
test("creates a deployment with force", async () => { | ||
const isDeployed = factory.deploy({ | ||
ref: "refs/heads/featureA", | ||
task: "foobar", | ||
transient_environment: false, | ||
production_environment: true, | ||
environment: "production", | ||
auto_merge: true, | ||
required_contexts: [], | ||
description: "A test environment based on Docker", | ||
payload: { target: "production" } | ||
}); | ||
factory.config({ valid: true }); | ||
|
||
const github = new Octokit({ auth: "test" }); | ||
|
||
await deploy(github, probot.logger, factory.store, { | ||
owner: "Codertocat", | ||
repo: "Hello-World", | ||
ref: "refs/heads/featureA", | ||
sha: "0000000000000000000000000000000000000000", | ||
target: "production", | ||
task: "foobar", | ||
force: true, | ||
}); | ||
expect(isDeployed.isDone()).toBe(true); | ||
}); | ||
}); |
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