mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-03-15 20:02:35 +08:00
Sarpik/get input list support (#829)
* feat(core): Create `getInputList` utility Signed-off-by: Kipras Melnikovas <kipras@kipras.org> * chore(core): Document usage of '\n' instead of [] @ `getInputList` Signed-off-by: Kipras Melnikovas <kipras@kipras.org> * test(core): Create a very simple test for `getInputList` Signed-off-by: Kipras Melnikovas <kipras@kipras.org> * run linter * update commands/readme Co-authored-by: Kipras Melnikovas <kipras@kipras.org>
This commit is contained in:
@@ -29,6 +29,8 @@ const testEnvVars = {
|
||||
INPUT_WRONG_BOOLEAN_INPUT: 'wrong',
|
||||
INPUT_WITH_TRAILING_WHITESPACE: ' some val ',
|
||||
|
||||
INPUT_MY_INPUT_LIST: 'val1\nval2\nval3',
|
||||
|
||||
// Save inputs
|
||||
STATE_TEST_1: 'state_val',
|
||||
|
||||
@@ -166,6 +168,14 @@ describe('@actions/core', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('getMultilineInput works', () => {
|
||||
expect(core.getMultilineInput('my input list')).toEqual([
|
||||
'val1',
|
||||
'val2',
|
||||
'val3'
|
||||
])
|
||||
})
|
||||
|
||||
it('getInput trims whitespace by default', () => {
|
||||
expect(core.getInput('with trailing whitespace')).toBe('some val')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user