Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: output deployed action list #644

Merged
merged 2 commits into from
Apr 4, 2023
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
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