Add mocks to tests

This commit is contained in:
Nick Cipollo
2019-08-26 20:35:39 -04:00
parent 4e291a9639
commit 028c2af361
7 changed files with 137 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
import { Inputs } from "./Inputs";
import { Releases } from "./Releases";
import { basename } from "path";
export class Action {
private inputs: Inputs
@@ -9,4 +10,22 @@ export class Action {
this.inputs = inputs
this.releases = releases
}
async perform() {
const createResult = await this.releases.create(
this.inputs.tag,
this.inputs.body,
this.inputs.commit,
this.inputs.draft,
this.inputs.name)
if (this.inputs.artifact) {
await this.releases.uploadArtifact(
createResult.data.assets_url,
this.inputs.artifactContentLength,
this.inputs.artifactContentType,
this.inputs.artifact,
basename(this.inputs.artifact))
}
}
}