Remove unused isDeviceUUIDValid helper function

This commit is contained in:
Juan Cruz Viotti 2015-01-09 13:28:27 -03:00
parent 0753bd1fe9
commit 2b5c1a664e
2 changed files with 0 additions and 35 deletions

View File

@ -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) ->

View File

@ -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', ->