overleaf/services/web/test/unit/coffee/helpers/MockClient.coffee

18 lines
374 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
sinon = require('sinon')
idCounter = 0
module.exports = class MockClient
constructor: () ->
@attributes = {}
@join = sinon.stub()
@emit = sinon.stub()
@disconnect = sinon.stub()
@id = idCounter++
set : (key, value, callback) ->
@attributes[key] = value
callback() if callback?
get : (key, callback) ->
callback null, @attributes[key]
disconnect: () ->