Skip to content

Commit

Permalink
fix: validation errors when no scopes configured (#66)
Browse files Browse the repository at this point in the history
* add failing test case

* fix: validation errors when no scopes configured
  • Loading branch information
MichaelGoberling authored Jun 13, 2024
1 parent 357281a commit 0b88331
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function main () {
const command = core.getInput('command')
const noPublish = core.getInput('noPublish')
const key = core.getInput('key')
const scopes = core.getInput('scopes')
const scopes = core.getInput('scopes') || undefined
const clientId = core.getInput('clientId')
const clientSecret = core.getInput('clientSecret')
const techAccId = core.getInput('technicalAccountId')
Expand Down
14 changes: 14 additions & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ describe('generateOAuthSTSAuthToken', () => {
await expect(generateOAuthSTSAuthToken(inputs)).rejects.toThrow('[generateOAuthSTSAuthToken] Validation errors:')
})

test('scopes is an empty string', async () => {
const inputs = {
ims,
key: 'key',
clientId: 'client-id',
clientSecret: 'client-secret',
techAccId: 'tech-acct-id',
techAccEmail: 'tech-acct-email',
imsOrgId: 'ims-org-id',
scopes: ''
}
await expect(generateOAuthSTSAuthToken(inputs)).rejects.toThrow('[generateOAuthSTSAuthToken] Validation errors:')
})

test('use default scopes', async () => {
const inputs = {
ims,
Expand Down

0 comments on commit 0b88331

Please sign in to comment.