Skip to content

Commit

Permalink
fix: ACNA-2963 - an action with annotation web-export: raw should be …
Browse files Browse the repository at this point in the history
…considered a web action in getActionUrl (#189)
  • Loading branch information
shazron authored Apr 30, 2024
1 parent b8b0b61 commit 4cec293
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ function getActionUrls (appConfig, /* istanbul ignore next */ isRemoteDev = fals

/** @private */
function getActionUrl (pkgAndActionName, action) {
const webArg = action['web-export'] || action.web
const webArg = action?.annotations?.['web-export'] || action?.web
const webUri = (webArg && webArg !== 'no' && webArg !== 'false') ? 'web' : ''

const actionIsBehindCdn =
Expand Down
16 changes: 16 additions & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1944,6 +1944,21 @@ describe('getActionUrls', () => {
expect(result).toEqual(expected)
})

test('web-export and web raw test', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.adobeioruntime.net/api/v1/web/sample-app-1.0.0/action',
'sample-app-1.0.0/action-sequence': 'https://fake_ns.adobeioruntime.net/api/v1/web/sample-app-1.0.0/action-sequence',
'sample-app-1.0.0/action-zip': 'https://fake_ns.adobeioruntime.net/api/v1/web/sample-app-1.0.0/action-zip',
'pkg2/thataction': 'https://fake_ns.adobeioruntime.net/api/v1/web/pkg2/thataction',
'pkg2/thatsequence': 'https://fake_ns.adobeioruntime.net/api/v1/web/pkg2/thatsequence'
}
config.manifest.full.packages.__APP_PACKAGE__.actions.action.web = 'raw'
delete config.manifest.full.packages.__APP_PACKAGE__.actions['action-zip'].web
config.manifest.full.packages.__APP_PACKAGE__.actions['action-zip'].annotations = { 'web-export': 'raw' }
const result = utils.getActionUrls(config, true, false)
expect(result).toEqual(expected)
})

test('some non web actions, with ui, no dev, custom apihost, custom hostname => use custom hostname everywhere', () => {
const expected = {
'sample-app-1.0.0/action': 'https://fake_ns.custom.net/api/v1/web/sample-app-1.0.0/action',
Expand Down Expand Up @@ -2089,6 +2104,7 @@ describe('getActionUrls', () => {
const result = utils.getActionUrls(config, false, false)
expect(result).toEqual(expect.objectContaining(expected))
})

test('urls with action keys when legacy on', () => {
const expected = {
'pkg2/thataction': 'https://fake_ns.adobeio-static.net/api/v1/web/pkg2/thataction',
Expand Down

0 comments on commit 4cec293

Please sign in to comment.