generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
297 additions
and
17 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,44 @@ | ||
import {ActionSkipper, ReleaseActionSkipper} from "../src/ActionSkipper"; | ||
import {Releases} from "../src/Releases"; | ||
|
||
describe("shouldSkip", () => { | ||
const getMock = jest.fn() | ||
const tag = "tag" | ||
const MockReleases = jest.fn<Releases, any>(() => { | ||
return { | ||
create: jest.fn(), | ||
deleteArtifact: jest.fn(), | ||
getByTag: getMock, | ||
listArtifactsForRelease: jest.fn(), | ||
listReleases: jest.fn(), | ||
update: jest.fn(), | ||
uploadArtifact: jest.fn() | ||
} | ||
}) | ||
|
||
it('should return false when skipIfReleaseExists is false', async () => { | ||
const actionSkipper = new ReleaseActionSkipper(false, MockReleases(), tag) | ||
expect(await actionSkipper.shouldSkip()).toBe(false) | ||
}) | ||
|
||
it('should return false when error occurs', async () => { | ||
getMock.mockRejectedValue(new Error()) | ||
|
||
const actionSkipper = new ReleaseActionSkipper(true, MockReleases(), tag) | ||
expect(await actionSkipper.shouldSkip()).toBe(false) | ||
}) | ||
|
||
it('should return false when release does not exist', async () => { | ||
getMock.mockResolvedValue({}) | ||
|
||
const actionSkipper = new ReleaseActionSkipper(true, MockReleases(), tag) | ||
expect(await actionSkipper.shouldSkip()).toBe(false) | ||
}) | ||
|
||
it('should return true when release does exist', async () => { | ||
getMock.mockResolvedValue({data: {}}) | ||
|
||
const actionSkipper = new ReleaseActionSkipper(true, MockReleases(), tag) | ||
expect(await actionSkipper.shouldSkip()).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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
skipIfReleaseExists
must be documented as boolean; possible valuestrue
/false
, not "current repo".