mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Return unknown if no matches in device.getDisplayName()
This commit is contained in:
parent
f0e1effc05
commit
d77e671648
@ -5,4 +5,4 @@ exports.getDisplayName = (device) ->
|
|||||||
for key, value of DEVICE_NAMES
|
for key, value of DEVICE_NAMES
|
||||||
if _.indexOf(value, device) isnt -1
|
if _.indexOf(value, device) isnt -1
|
||||||
return key
|
return key
|
||||||
|
return 'Unknown'
|
||||||
|
@ -6,8 +6,6 @@ describe 'Device:', ->
|
|||||||
describe '#getDisplayName()', ->
|
describe '#getDisplayName()', ->
|
||||||
|
|
||||||
it 'should return Raspberry Pi for that device', ->
|
it 'should return Raspberry Pi for that device', ->
|
||||||
displayName = 'Raspberry Pi'
|
|
||||||
|
|
||||||
possibleNames = [
|
possibleNames = [
|
||||||
'raspberry-pi'
|
'raspberry-pi'
|
||||||
'raspberrypi'
|
'raspberrypi'
|
||||||
@ -15,4 +13,15 @@ describe 'Device:', ->
|
|||||||
]
|
]
|
||||||
|
|
||||||
for name in possibleNames
|
for name in possibleNames
|
||||||
expect(device.getDisplayName(name)).to.equal(displayName)
|
expect(device.getDisplayName(name)).to.equal('Raspberry Pi')
|
||||||
|
|
||||||
|
it 'should return unknown if no matches', ->
|
||||||
|
unknownNames = [
|
||||||
|
'hello'
|
||||||
|
'foobar'
|
||||||
|
{}
|
||||||
|
123
|
||||||
|
]
|
||||||
|
|
||||||
|
for name in unknownNames
|
||||||
|
expect(device.getDisplayName(name)).to.equal('Unknown')
|
||||||
|
Loading…
Reference in New Issue
Block a user