generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1 Allow for multiple artifacts
- Loading branch information
Showing
2 changed files
with
31 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
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") | ||
}) | ||
}) |
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,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; | ||
} | ||
} |