Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions schema/app.config.yaml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,17 @@
"type": "object",
"properties": {
"function": { "type": "string" },
"web": { "type": "string" },
"web": {
"anyOf" : [
{"type": "string" },
{"type": "boolean" }
]
},
"runtime": { "type": "string" },
"inputs": { "$ref": "#/definitions/inputs" },
"annotations": { "$ref": "#/definitions/annotations" }
"annotations": { "$ref": "#/definitions/annotations" },
"web-export": { "not": {} },
"raw-http": { "not": {} }
},
"required": []
},
Expand Down
4 changes: 2 additions & 2 deletions test/__fixtures__/app-exc-nui/app.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ application:
concurrency: 189
'action-zip':
function: 'myactions/action-zip'
web: 'yes'
web: 'true'
runtime: 'nodejs:14'
sequences:
'action-sequence':
actions: 'action, action-zip'
web: 'yes'
web: true
triggers:
trigger1: null
rules:
Expand Down
4 changes: 2 additions & 2 deletions test/__fixtures__/app/app.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ application:
concurrency: 189
'action-zip':
function: 'myactions/action-zip'
web: 'yes'
web: 'true'
runtime: 'nodejs:14'
sequences:
'action-sequence':
actions: 'action, action-zip'
web: 'yes'
web: true
triggers:
trigger1: null
rules:
Expand Down
4 changes: 2 additions & 2 deletions test/__fixtures__/legacy-app/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ packages:
concurrency: 189
'action-zip':
function: 'myactions/action-zip'
web: 'yes'
web: 'true'
runtime: 'nodejs:14'
sequences:
'action-sequence':
actions: 'action, action-zip'
web: 'yes'
web: true
triggers:
trigger1: null
rules:
Expand Down
4 changes: 2 additions & 2 deletions test/data-mocks/config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ function fullFakeRuntimeManifest (pathToActionFolder, pkgName1) {
},
'action-zip': {
function: winCompat(`${pathToActionFolder}/action-zip`),
web: 'yes',
web: 'true',
runtime: 'nodejs:14'
}
},
sequences: {
'action-sequence': {
actions: 'action, action-zip',
web: 'yes'
web: true
}
},
triggers: {
Expand Down
84 changes: 83 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,51 @@ describe('load config', () => {
test('exc with events config', async () => {
global.loadFixtureApp('exc-with-events')
config = await appConfig.load({})
expect(config.all['dx/excshell/1']).toEqual(expect.objectContaining({ events: { registrations: { 'Demo name': { description: 'Demo description', events_of_interest: [{ event_codes: ['com.adobe.platform.gdpr.joberror', 'com.adobe.platform.gdpr.producterror'], provider_metadata: 'gdpr_events' }, { event_codes: ['test-code-skrishna', 'card_abandonment'], provider_metadata: 'aem' }], runtime_action: 'my-exc-package/action' }, 'Event Registration Default': { description: 'Registration for IO Events', events_of_interest: [{ event_codes: ['com.adobe.platform.gdpr.joberror', 'com.adobe.platform.gdpr.producterror'], provider_metadata: 'gdpr_events' }], runtime_action: 'my-exc-package/action' } } } }))
const eventObj = {
events:
{
registrations:
{
'Demo name':
{
description: 'Demo description',
events_of_interest:
[
{
event_codes:
[
'com.adobe.platform.gdpr.joberror',
'com.adobe.platform.gdpr.producterror'
],
provider_metadata: 'gdpr_events'
},
{
event_codes: ['test-code-skrishna', 'card_abandonment'],
provider_metadata: 'aem'
}
],
runtime_action: 'my-exc-package/action'
},
'Event Registration Default':
{
description: 'Registration for IO Events',
events_of_interest:
[
{
event_codes:
[
'com.adobe.platform.gdpr.joberror',
'com.adobe.platform.gdpr.producterror'
],
provider_metadata: 'gdpr_events'
}
],
runtime_action: 'my-exc-package/action'
}
}
}
}
expect(config.all['dx/excshell/1']).toEqual(expect.objectContaining(eventObj))
})

test('standalone app, exc and nui extension config', async () => {
Expand Down Expand Up @@ -287,6 +331,44 @@ extensions:
expect(config.implements).toEqual(['application'])
})

test('action config with web-export not in annotations', async () => {
global.fakeFileSystem.addJson({
'/package.json': '{}',
'/app.config.yaml':
`
application:
runtimeManifest:
packages:
myapp:
actions:
generic:
function: actions/generic/index.js
runtime: nodejs:18
web-export: raw
`
})
await expect(appConfig.load({})).rejects.toThrow('Missing or invalid keys in app.config.yaml:')
})

test('action config with raw-http not in annotations', async () => {
global.fakeFileSystem.addJson({
'/package.json': '{}',
'/app.config.yaml':
`
application:
runtimeManifest:
packages:
myapp:
actions:
generic:
function: actions/generic/index.js
runtime: nodejs:18
raw-http: true
`
})
await expect(appConfig.load({})).rejects.toThrow('Missing or invalid keys in app.config.yaml:')
})

// options
test('standalone app config - ignoreAioConfig=true', async () => {
global.loadFixtureApp('app')
Expand Down
Loading