mirror of
https://github.com/actions/toolkit.git
synced 2026-08-16 00:00:21 +02:00
Sarpik/get input list support (#829)
* feat(core): Create `getInputList` utility Signed-off-by: Kipras Melnikovas <[email protected]> * chore(core): Document usage of '\n' instead of [] @ `getInputList` Signed-off-by: Kipras Melnikovas <[email protected]> * test(core): Create a very simple test for `getInputList` Signed-off-by: Kipras Melnikovas <[email protected]> * run linter * update commands/readme Co-authored-by: Kipras Melnikovas <[email protected]>
This commit is contained in:
co-authored by
Kipras Melnikovas
parent
dc4b4dab1d
commit
bb2f39337d
@@ -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