diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index fd19360..fa4384b 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -56,6 +56,22 @@ describe('Parse Parameters', () => { ]) }) + test('returns parameters list from string', async () => { + const json = parseParameters( + 'MyParam1=myValue1,MyParam2=myValue2,MyParam2=myValue3' + ) + expect(json).toEqual([ + { + ParameterKey: 'MyParam1', + ParameterValue: 'myValue1' + }, + { + ParameterKey: 'MyParam2', + ParameterValue: 'myValue2,myValue3' + } + ]) + }) + test('returns parameters list from file', async () => { const filename = 'file://' + path.join(__dirname, 'params.test.json') const json = parseParameters(filename) diff --git a/src/utils.ts b/src/utils.ts index ae05fef..7e40928 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -47,6 +47,7 @@ export function parseParameters(parameterOverrides: string): Parameter[] { throw err } } + const parameters = new Map() parameterOverrides.split(',').forEach(parameter => { const [key, value] = parameter.trim().split('=')