Skip to content

Commit

Permalink
fix: output deployed action list (#644)
Browse files Browse the repository at this point in the history
Co-authored-by: raho <hi@moritzraho.com>
Co-authored-by: Shazron Abdullah <36107+shazron@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 4, 2023
1 parent 854d524 commit c391017
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 54 deletions.
7 changes: 2 additions & 5 deletions src/lib/app-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
9 changes: 1 addition & 8 deletions test/commands/app/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') => {
Expand Down
38 changes: 5 additions & 33 deletions test/commands/lib/app-helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
9 changes: 1 addition & 8 deletions test/commands/lib/deploy-actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit c391017

Please sign in to comment.