From 2b5c1a664e56b28423ef2fd9d28240c6ae041095 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 9 Jan 2015 13:28:27 -0300 Subject: [PATCH] Remove unused isDeviceUUIDValid helper function --- lib/helpers/helpers.coffee | 7 ------- lib/helpers/helpers.spec.coffee | 28 ---------------------------- 2 files changed, 35 deletions(-) diff --git a/lib/helpers/helpers.coffee b/lib/helpers/helpers.coffee index 7d66af69..034cbc08 100644 --- a/lib/helpers/helpers.coffee +++ b/lib/helpers/helpers.coffee @@ -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) -> diff --git a/lib/helpers/helpers.spec.coffee b/lib/helpers/helpers.spec.coffee index 8a2ff236..0ea950aa 100644 --- a/lib/helpers/helpers.spec.coffee +++ b/lib/helpers/helpers.spec.coffee @@ -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', ->