Skip to content

Commit be96e40

Browse files
author
Tristan payne
committed
test: add test for replacing refs/heads in branch
1 parent 2d7815f commit be96e40

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

__tests__/create-branch.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ describe('Create a branch based on the input', () => {
5555
})
5656
});
5757

58+
it('Replaces refs/heads in branch name', async () => {
59+
octokitMock.repos.getBranch.mockRejectedValue(new HttpError())
60+
await createBranch(githubMock, contextMock, `refs/heads/${branch}`)
61+
expect(octokitMock.git.createRef).toHaveBeenCalledWith({
62+
ref: 'refs/heads/release-v1',
63+
sha: 'ebb4992dc72451c1c6c99e1cce9d741ec0b5b7d7'
64+
})
65+
});
66+
5867
it('fails if github token isn\'t defined', async() => {
5968
delete process.env.GITHUB_TOKEN
6069
expect.assertions(1);

0 commit comments

Comments
 (0)