mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27: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
|
||||
if _.indexOf(value, device) isnt -1
|
||||
return key
|
||||
|
||||
return 'Unknown'
|
||||
|
@ -6,8 +6,6 @@ describe 'Device:', ->
|
||||
describe '#getDisplayName()', ->
|
||||
|
||||
it 'should return Raspberry Pi for that device', ->
|
||||
displayName = 'Raspberry Pi'
|
||||
|
||||
possibleNames = [
|
||||
'raspberry-pi'
|
||||
'raspberrypi'
|
||||
@ -15,4 +13,15 @@ describe 'Device:', ->
|
||||
]
|
||||
|
||||
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