browser-meshblu-http
Version:
Meshblu Client for the Browser
41 lines (32 loc) • 1.1 kB
text/coffeescript
shmock = require '@octoblu/shmock'
MeshbluHttp = require '../'
describe 'Search Tokens', ->
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 token has multiple tokens', ->
beforeEach (done) ->
auth = new Buffer('some-uuid:some-token').toString('base64')
=
.post '/search/tokens'
.set 'Authorization', "Basic #{auth}"
.reply 200, [
uuid: 'howdy-uuid', metadata: tag: 'test'
]
query = 'metadata.tag': 'test'
.searchTokens {query}, (error, ) => done error
it 'should call get token', ->
.done()
it 'should have tokens', ->
expect().to.deep.equal [
uuid: 'howdy-uuid', metadata: tag: 'test'
]