Skip to content

Commit 4726c0d

Browse files
display blank for undefined environment description. fixes #54 (#55)
1 parent 7e9a865 commit 4726c0d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/commands/cloudmanager/list-environments.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ class ListEnvironmentsCommand extends Command {
4444
},
4545
name: {},
4646
type: {},
47-
description: {}
47+
description: {
48+
header: "Description",
49+
get: item => item.description ? item.description : ""
50+
}
4851
}, {
4952
printLine: this.log
5053
})

test/commands/list-environments.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
1010
governing permissions and limitations under the License.
1111
*/
1212

13+
const { cli } = require('cli-ux')
1314
const { setStore } = require('@adobe/aio-cna-core-config')
1415
const ListEnvironmentsCommand = require('../../src/commands/cloudmanager/list-environments')
1516

@@ -80,7 +81,7 @@ test('list-environments - success', async () => {
8081
'cloudmanager_programid': "4"
8182
})
8283

83-
expect.assertions(2)
84+
expect.assertions(4)
8485

8586
let runResult = ListEnvironmentsCommand.run([])
8687
await expect(runResult instanceof Promise).toBeTruthy()
@@ -99,6 +100,8 @@ test('list-environments - success', async () => {
99100
name: "TestProgram_dev",
100101
type: "dev"
101102
}])
103+
await expect(cli.table.mock.calls[0][1].description.get({})).toBe("")
104+
await expect(cli.table.mock.calls[0][1].description.get({description: "foo"})).toBe("foo")
102105
})
103106

104107

0 commit comments

Comments
 (0)