Skip to content

Commit

Permalink
Merge pull request #332 from github/improved-messaging
Browse files Browse the repository at this point in the history
Improved Messaging
  • Loading branch information
GrantBirki authored Dec 9, 2024
2 parents 0c15b9a + cf9deca commit 691e5df
Show file tree
Hide file tree
Showing 17 changed files with 1,077 additions and 714 deletions.
9 changes: 9 additions & 0 deletions __tests__/functions/environment-targets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ test('checks the comment body and finds an explicit environment target for stagi
'environment_url',
'http://staging.example.com'
)
expect(saveStateMock).toHaveBeenCalledWith('params', '')
expect(saveStateMock).toHaveBeenCalledWith('parsed_params', '')
expect(setOutputMock).toHaveBeenCalledWith(
'environment_url',
'http://staging.example.com'
Expand Down Expand Up @@ -451,6 +453,13 @@ test('checks the comment body and finds an explicit environment target for stagi
'environment_url',
'http://staging.example.com'
)
expect(saveStateMock).toHaveBeenCalledWith(
'params',
'something1 something2 something3'
)
expect(saveStateMock).toHaveBeenCalledWith('parsed_params', {
_: ['something1', 'something2', 'something3']
})
expect(setOutputMock).toHaveBeenCalledWith(
'environment_url',
'http://staging.example.com'
Expand Down
10 changes: 8 additions & 2 deletions __tests__/functions/params.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ test('it parses boolean values correctly', async () => {
})

test('it parses nested objects correctly', async () => {
const parsed = parseParams('--config.db.host=localhost --config.db.port=5432')
const parsed = parseParams(
'LOG_LEVEL=debug --config.db.host=localhost --config.db.port=5432'
)
expect(parsed).toHaveProperty('config', {db: {host: 'localhost', port: 5432}})
expect(parsed).toHaveProperty('_', [])
expect(parsed).toHaveProperty('_', ['LOG_LEVEL=debug'])
expect(parsed).toStrictEqual({
config: {db: {host: 'localhost', port: 5432}},
_: ['LOG_LEVEL=debug']
})
})

test('it parses a real world example correctly', async () => {
Expand Down
Loading

0 comments on commit 691e5df

Please sign in to comment.