diff --git a/src/lib/app-helper.js b/src/lib/app-helper.js index ce9b152a..81d48d3e 100644 --- a/src/lib/app-helper.js +++ b/src/lib/app-helper.js @@ -497,14 +497,11 @@ function deleteUserConfig (configData) { /** @private */ const createWebExportFilter = (filterValue) => { return (action) => { - if (!action || !action.body || !action.body.annotations) { + if (!action || !action.annotations) { return false } - const weAnnotation = action.body.annotations.filter(a => a.key === 'web-export') - const weValue = (weAnnotation.length > 0) ? !!(weAnnotation[0].value) : false - - return (filterValue === weValue) + return String(!!action.annotations['web-export']) === String(filterValue) } } diff --git a/test/commands/app/deploy.test.js b/test/commands/app/deploy.test.js index db8e0083..378e5a8b 100644 --- a/test/commands/app/deploy.test.js +++ b/test/commands/app/deploy.test.js @@ -61,14 +61,7 @@ jest.mock('../../../src/lib/log-forwarding', () => { const LogForwarding = require('../../../src/lib/log-forwarding') const createWebExportAnnotation = (value) => ({ - body: { - annotations: [ - { - key: 'web-export', - value - } - ] - } + annotations: { 'web-export': value } }) const createAppConfig = (aioConfig = {}, appFixtureName = 'legacy-app') => { diff --git a/test/commands/lib/app-helper.test.js b/test/commands/lib/app-helper.test.js index 53dbff2e..3a126676 100644 --- a/test/commands/lib/app-helper.test.js +++ b/test/commands/lib/app-helper.test.js @@ -874,7 +874,7 @@ describe('createWebExportFilter', () => { test('no web-export annotation', () => { const action = { - name: 'abcde', url: 'https://fake.site', body: { annotations: [] } + name: 'abcde', url: 'https://fake.site', annotations: [] } expect(webFilter(action)).toEqual(false) @@ -885,14 +885,7 @@ describe('createWebExportFilter', () => { const action1 = { name: 'abcde', url: 'https://fake.site', - body: { - annotations: [ - { - key: 'web-export', - value: true - } - ] - } + annotations: { 'web-export': true } } expect(webFilter(action1)).toEqual(true) @@ -901,14 +894,7 @@ describe('createWebExportFilter', () => { const action2 = { name: 'abcde', url: 'https://fake.site', - body: { - annotations: [ - { - key: 'web-export', - value: 1 - } - ] - } + annotations: { 'web-export': 1 } } expect(webFilter(action2)).toEqual(true) @@ -919,14 +905,7 @@ describe('createWebExportFilter', () => { const action1 = { name: 'abcde', url: 'https://fake.site', - body: { - annotations: [ - { - key: 'web-export', - value: false - } - ] - } + annotations: { 'web-export': false } } expect(webFilter(action1)).toEqual(false) @@ -935,14 +914,7 @@ describe('createWebExportFilter', () => { const action2 = { name: 'abcde', url: 'https://fake.site', - body: { - annotations: [ - { - key: 'web-export', - value: null - } - ] - } + annotations: { 'web-export': null } } expect(webFilter(action2)).toEqual(false) diff --git a/test/commands/lib/deploy-actions.test.js b/test/commands/lib/deploy-actions.test.js index 79b4c018..0a8d376f 100644 --- a/test/commands/lib/deploy-actions.test.js +++ b/test/commands/lib/deploy-actions.test.js @@ -18,14 +18,7 @@ const appHelperActual = jest.requireActual('../../../src/lib/app-helper') jest.mock('../../../src/lib/app-helper') const createWebExportAnnotation = (value) => ({ - body: { - annotations: [ - { - key: 'web-export', - value - } - ] - } + annotations: { 'web-export': value } }) beforeEach(() => {