browser-meshblu-http
Version:
Meshblu Client for the Browser
53 lines (40 loc) • 1.54 kB
text/coffeescript
shmock = require '@octoblu/shmock'
MeshbluHttp = require '../'
describe 'Get Device', ->
beforeEach ->
= shmock 0xd00d
afterEach (done) ->
.close => done()
describe 'when constructed with valid meshbluConfig', ->
beforeEach ->
meshbluConfig =
hostname: 'localhost'
port: 0xd00d
uuid: 'some-uuid'
token: 'some-token'
= new MeshbluHttp meshbluConfig
describe 'when the device has multiple devices (????)', ->
beforeEach (done) ->
auth = new Buffer('some-uuid:some-token').toString('base64')
=
.get '/v2/devices/hello-uuid'
.set 'Authorization', "Basic #{auth}"
.reply 200, uuid: 'hello-uuid'
.device "hello-uuid", (error, ) => done error
it 'should call get device', ->
.done()
it 'should device', ->
expect().to.deep.equal uuid: 'hello-uuid'
describe 'when called with "as" ', ->
beforeEach (done) ->
auth = new Buffer('some-uuid:some-token').toString('base64')
=
.get '/v2/devices/hello-uuid'
.set 'Authorization', "Basic #{auth}"
.set 'x-meshblu-as', '5'
.reply 200, uuid: 'hello-uuid'
.device "hello-uuid", {as: '5'}, (error, ) => done error
it 'should call get device', ->
.done()
it 'should device', ->
expect().to.deep.equal uuid: 'hello-uuid'