browser-meshblu-http
Version:
Meshblu Client for the Browser
45 lines (36 loc) • 1.11 kB
text/coffeescript
shmock = require '@octoblu/shmock'
MeshbluHttp = require '../'
describe 'Whoami', ->
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 devices', ->
beforeEach (done) ->
auth = new Buffer('some-uuid:some-token').toString('base64')
=
.get '/v2/whoami'
.set 'Authorization', "Basic #{auth}"
.reply 200,
uuid: 'some-uuid',
devices: [
{uuid:'cheers-uuid'}
]
.whoami (error, ) => done error
it 'should call get device', ->
.done()
it 'should device', ->
device =
uuid: 'some-uuid',
devices: [
{uuid:'cheers-uuid'}
]
expect().to.deep.equal device