Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Create release endpoint test
- Loading branch information
Thomas Hughes
committed
Sep 26, 2019
1 parent
782415a
commit aa6f452
Showing
3 changed files
with
47 additions
and
4 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 |
---|---|---|
@@ -1,6 +1,49 @@ | ||
jest.mock('@actions/core'); | ||
jest.mock('@actions/github'); | ||
|
||
const core = require('@actions/core'); | ||
const { GitHub, context } = require('@actions/github'); | ||
const run = require('../src/main.js'); | ||
|
||
/* eslint-disable no-undef */ | ||
describe('Create release', () => { | ||
test('Create release endpoint is called', async () => {}); | ||
describe('module', () => { | ||
let createRelease; | ||
|
||
beforeEach(() => { | ||
core.getInput = jest.fn() | ||
.mockReturnValueOnce('refs/tags/v1.0.0') | ||
.mockReturnValueOnce('myRelease') | ||
.mockReturnValueOnce('false') | ||
.mockReturnValueOnce('false'); | ||
|
||
createRelease = jest.fn(); | ||
|
||
context.repo = { | ||
owner: 'owner', | ||
repo: 'repo' | ||
}; | ||
|
||
const github = { | ||
repos: { | ||
createRelease | ||
} | ||
}; | ||
|
||
GitHub.mockImplementation(() => github); | ||
}); | ||
|
||
test('Create release endpoint is called', async () => { | ||
await run(); | ||
|
||
expect(createRelease).toHaveBeenCalledWith({ | ||
owner: 'owner', | ||
repo: 'repo', | ||
tag_name: 'v1.0.0', | ||
name: 'myRelease', | ||
draft: false, | ||
prerelease: false | ||
}); | ||
}); | ||
|
||
test('Outputs are set', async () => {}); | ||
}); |