mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-17 03:25:43 +00:00
refactor: extract config (#257)
* refactor: extract config * test: mock dynamic value
This commit is contained in:
parent
9945cf63fa
commit
56ac27318d
8 changed files with 201 additions and 76 deletions
22
__tests__/config.test.ts
Normal file
22
__tests__/config.test.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import * as process from 'process'
|
||||
|
||||
test('test runs', () => {
|
||||
process.env['INPUT_HEADER'] = ''
|
||||
process.env['INPUT_NUMBER'] = '123'
|
||||
process.env['INPUT_APPEND'] = 'false'
|
||||
process.env['INPUT_RECREATE'] = 'false'
|
||||
process.env['INPUT_DELETE'] = 'false'
|
||||
process.env['INPUT_GITHUB_TOKEN'] = 'some-token'
|
||||
process.env['GITHUB_REPOSITORY'] = 'marocchino/stick-pull-request-comment'
|
||||
expect(require('../src/config')).toMatchObject({
|
||||
pullRequestNumber: expect.any(Number),
|
||||
repo: {owner: 'marocchino', repo: 'stick-pull-request-comment'},
|
||||
message: '',
|
||||
path: '',
|
||||
header: '',
|
||||
append: false,
|
||||
recreate: false,
|
||||
deleteOldComment: false,
|
||||
githubToken: 'some-token'
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue