mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Prevent some undefined js errors
This commit is contained in:
parent
12fc2e3bfb
commit
1165113240
@ -4,11 +4,13 @@ tableHelpers = require('./table-helpers')
|
||||
# TODO: Maybe there is a (sane) way to test this, given
|
||||
# that the result is not automatically printed by cliff?
|
||||
exports.horizontal = (contents, map, ordering, colours) ->
|
||||
return if not contents?
|
||||
contents = tableHelpers.processTableContents(contents, map)
|
||||
ordering = tableHelpers.normaliseOrdering(ordering, contents)
|
||||
return cliff.stringifyObjectRows(contents, ordering, colours)
|
||||
|
||||
exports.vertical = (contents, map, ordering) ->
|
||||
return if not contents?
|
||||
contents = tableHelpers.processTableContents(contents, map)
|
||||
ordering = tableHelpers.normaliseOrdering(ordering, contents)
|
||||
|
||||
|
@ -32,3 +32,11 @@ describe 'Table:', ->
|
||||
|
||||
for line in expected
|
||||
expect(result.indexOf(line)).to.not.equal(-1)
|
||||
|
||||
it 'should return undefined if contents does not exist', ->
|
||||
expect(table.vertical(undefined)).to.be.undefined
|
||||
|
||||
describe '#horizontal()', ->
|
||||
|
||||
it 'should return undefined if contents does not exist', ->
|
||||
expect(table.horizontal(undefined)).to.be.undefined
|
||||
|
Loading…
Reference in New Issue
Block a user