try body as file, use as string otherwise
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/github');
|
||||
jest.mock('fs');
|
||||
|
||||
const core = require('@actions/core');
|
||||
const { GitHub, context } = require('@actions/github');
|
||||
const fs = require('fs');
|
||||
const run = require('../src/create-release.js');
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
@@ -120,6 +122,30 @@ describe('Create Release', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('Release body based on file', async () => {
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockReturnValueOnce('refs/tags/v1.0.0')
|
||||
.mockReturnValueOnce('myRelease')
|
||||
.mockReturnValueOnce('notes.md')
|
||||
.mockReturnValueOnce('false')
|
||||
.mockReturnValueOnce('false');
|
||||
|
||||
fs.readFileSync = jest.fn().mockReturnValueOnce('# this is a release\nThe markdown is strong in this one.');
|
||||
|
||||
await run();
|
||||
|
||||
expect(createRelease).toHaveBeenCalledWith({
|
||||
owner: 'owner',
|
||||
repo: 'repo',
|
||||
tag_name: 'v1.0.0',
|
||||
name: 'myRelease',
|
||||
body: '# this is a release\nThe markdown is strong in this one.',
|
||||
draft: false,
|
||||
prerelease: false
|
||||
});
|
||||
});
|
||||
|
||||
test('Outputs are set', async () => {
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
|
||||
Reference in New Issue
Block a user