Skip to content

Commit

Permalink
Fixes #1 Allow for multiple artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
ncipollo committed Sep 2, 2019
1 parent 261c1fc commit db81969
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions __tests__/Artifact.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Artifact } from "../src/Artifact";

describe("Artifact", () => {
it("defaults contentType to raw", () => {
const artifact = new Artifact("")
expect(artifact.contentType).toBe("raw")
})

it("generates name from path", () => {
const artifact = new Artifact("some/artifact")
expect(artifact.name).toBe("artifact")
})

it("provides path", () => {
const artifact = new Artifact("some/artifact")
expect(artifact.path).toBe("some/artifact")
})
})
13 changes: 13 additions & 0 deletions src/Artifact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { basename } from "path";

export class Artifact {
readonly contentType: string
readonly name: string
readonly path: string

constructor(path: string, contentType: string = "raw") {
this.path = path
this.name = basename(path)
this.contentType = contentType;
}
}

0 comments on commit db81969

Please sign in to comment.