browser-meshblu-http
Version:
Meshblu Client for the Browser
46 lines (36 loc) • 1.26 kB
text/coffeescript
{afterEach, beforeEach, describe, it} = global
{expect} = require 'chai'
shmock = require '@octoblu/shmock'
enableDestroy = require 'server-destroy'
MeshbluHttp = require '../'
describe 'Search Tokens', ->
beforeEach ->
= shmock()
enableDestroy
afterEach (done) ->
.destroy done
describe 'when constructed with valid meshbluConfig', ->
beforeEach ->
meshbluConfig =
hostname: 'localhost'
port: .address().port
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'
]