UNPKG

1.25 kBtext/coffeescriptView Raw
1{afterEach, beforeEach, describe, it} = global
2{expect} = require 'chai'
3sinon = require 'sinon'
4
5_ = require 'lodash'
6enableDestroy = require 'server-destroy'
7shmock = require 'shmock'
8SocketIO = require 'socket.io'
9
10
11Inquisitor = require '..'
12
13describe 'clearErrors', ->
14 beforeEach ->
15
16 meshbluConfig =
17 uuid: 'user-uuid'
18 token: 'user-token'
19 hostname: 'localhost'
20 port: 0xd00d
21 protocol: 'http'
22
23 uuid = 'inquisitor-uuid'
24
25 @userAuth = new Buffer('user-uuid:user-token').toString 'base64'
26 @sut = new Inquisitor {meshbluConfig, uuid}
27
28 it 'should exist', ->
29 expect(@sut).to.exist
30
31 describe '->clearErrors', ->
32 beforeEach 'meshblu', ->
33 @meshblu = shmock 0xd00d
34 enableDestroy(@meshblu)
35
36 afterEach (done) ->
37 @meshblu.destroy done
38
39 beforeEach ->
40 @clearErrorsHandler = @meshblu
41 .put "/v2/devices/the-device-uuid"
42 .set 'Authorization', "Basic #{@userAuth}"
43 .send $unset: errors: true
44 .reply 200
45
46 beforeEach (done) ->
47 @sut.clearErrors 'the-device-uuid', (@error) => done()
48 return null
49
50 it 'should clear the errors property on the status device', ->
51 @clearErrorsHandler.done()