mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-20 09:26:42 +00:00
Remove unused isDeviceUUIDValid helper function
This commit is contained in:
parent
0753bd1fe9
commit
2b5c1a664e
@ -1,11 +1,4 @@
|
||||
_ = require('lodash')
|
||||
resin = require('resin-sdk')
|
||||
|
||||
exports.isDeviceUUIDValid = (uuid, callback) ->
|
||||
resin.models.device.getAll (error, devices) ->
|
||||
return callback?(error) if error?
|
||||
uuidExists = _.findWhere(devices, { uuid })?
|
||||
return callback(null, uuidExists)
|
||||
|
||||
# TODO: Find a sane way to test streams
|
||||
exports.readStdin = (callback) ->
|
||||
|
@ -6,34 +6,6 @@ resin = require('resin-sdk')
|
||||
|
||||
describe 'Helpers:', ->
|
||||
|
||||
describe '#isDeviceUUIDValid()', ->
|
||||
|
||||
devices = [
|
||||
{ uuid: 1234 }
|
||||
{ uuid: 5678 }
|
||||
]
|
||||
|
||||
deviceGetAllStub = null
|
||||
|
||||
beforeEach ->
|
||||
deviceGetAllStub = sinon.stub(resin.models.device, 'getAll')
|
||||
deviceGetAllStub.yields(null, devices)
|
||||
|
||||
afterEach ->
|
||||
deviceGetAllStub.restore()
|
||||
|
||||
it 'should return true if there is a device with that UUID', (done) ->
|
||||
helpers.isDeviceUUIDValid devices[0].uuid, (error, isValid) ->
|
||||
expect(error).to.not.exist
|
||||
expect(isValid).to.be.true
|
||||
done()
|
||||
|
||||
it 'should return false if there is not a device with that UUID', (done) ->
|
||||
helpers.isDeviceUUIDValid 'invalidUUID', (error, isValid) ->
|
||||
expect(error).to.not.exist
|
||||
expect(isValid).to.be.false
|
||||
done()
|
||||
|
||||
describe '#parseCredentials', ->
|
||||
|
||||
describe 'given colon separated credentials', ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user