Skip to content

Commit

Permalink
(fix) adding tests for parameter map
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Aug 2, 2020
1 parent c31f5b5 commit a4dc90c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function parseParameters(parameterOverrides: string): Parameter[] {
throw err
}
}

const parameters = new Map<string, string>()
parameterOverrides.split(',').forEach(parameter => {
const [key, value] = parameter.trim().split('=')
Expand Down

0 comments on commit a4dc90c

Please sign in to comment.