Skip to content

Commit 40d33f9

Browse files
author
peterjgrainger
committed
update all dependencies
1 parent d10002e commit 40d33f9

File tree

6 files changed

+8837
-13028
lines changed

6 files changed

+8837
-13028
lines changed

__tests__/create-branch.test.ts

+16-13
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ describe('Create a branch based on the input', () => {
1010
let contextMock = JSON.parse(readFileSync('__tests__/context.json', 'utf8'));
1111
let githubMock = jest.fn();
1212
let octokitMock = {
13-
git: {
14-
createRef: jest.fn()
15-
},
16-
repos: {
17-
getBranch: jest.fn()
13+
rest: {
14+
git: {
15+
createRef: jest.fn()
16+
},
17+
repos: {
18+
getBranch: jest.fn()
19+
}
1820
}
21+
1922
};
2023

2124
beforeEach(() => {
@@ -24,38 +27,38 @@ describe('Create a branch based on the input', () => {
2427
});
2528

2629
it('gets a branch', async () => {
27-
octokitMock.repos.getBranch.mockRejectedValue(new HttpError())
30+
octokitMock.rest.repos.getBranch.mockRejectedValue(new HttpError())
2831
process.env.GITHUB_REPOSITORY = 'peterjgrainger/test-action-changelog-reminder'
2932
await createBranch(githubMock, context, branch)
30-
expect(octokitMock.repos.getBranch).toHaveBeenCalledWith({
33+
expect(octokitMock.rest.repos.getBranch).toHaveBeenCalledWith({
3134
repo: 'test-action-changelog-reminder',
3235
owner: 'peterjgrainger',
3336
branch
3437
})
3538
});
3639

3740
it('Creates a new branch if not already there', async () => {
38-
octokitMock.repos.getBranch.mockRejectedValue(new HttpError())
41+
octokitMock.rest.repos.getBranch.mockRejectedValue(new HttpError())
3942
await createBranch(githubMock, contextMock, branch)
40-
expect(octokitMock.git.createRef).toHaveBeenCalledWith({
43+
expect(octokitMock.rest.git.createRef).toHaveBeenCalledWith({
4144
ref: 'refs/heads/release-v1',
4245
sha: 'ebb4992dc72451c1c6c99e1cce9d741ec0b5b7d7'
4346
})
4447
});
4548

4649
it('Creates a new branch from a given commit SHA', async () => {
47-
octokitMock.repos.getBranch.mockRejectedValue(new HttpError())
50+
octokitMock.rest.repos.getBranch.mockRejectedValue(new HttpError())
4851
await createBranch(githubMock, contextMock, branch, sha)
49-
expect(octokitMock.git.createRef).toHaveBeenCalledWith({
52+
expect(octokitMock.rest.git.createRef).toHaveBeenCalledWith({
5053
ref: 'refs/heads/release-v1',
5154
sha: 'ffac537e6cbbf934b08745a378932722df287a53'
5255
})
5356
})
5457

5558
it('Replaces refs/heads in branch name', async () => {
56-
octokitMock.repos.getBranch.mockRejectedValue(new HttpError())
59+
octokitMock.rest.repos.getBranch.mockRejectedValue(new HttpError())
5760
await createBranch(githubMock, contextMock, `refs/heads/${branch}`)
58-
expect(octokitMock.git.createRef).toHaveBeenCalledWith({
61+
expect(octokitMock.rest.git.createRef).toHaveBeenCalledWith({
5962
ref: 'refs/heads/release-v1',
6063
sha: 'ebb4992dc72451c1c6c99e1cce9d741ec0b5b7d7'
6164
})

0 commit comments

Comments
 (0)