BattleSim/test/helpers.coffee

20 lines
394 B
CoffeeScript
Raw Normal View History

2016-02-01 22:19:30 +00:00
sinon = require 'sinon'
redis = require '../server/redis'
{EventEmitter} = require 'events'
process.env.NODE_ENV = 'test'
beforeEach ->
@sandbox = sinon.sandbox.create()
@clock = sinon.useFakeTimers()
@stubSpark = ->
ee = new EventEmitter()
ee.send = (->)
ee.end = (-> @emit('end'))
ee
afterEach (done) ->
@clock.restore()
@sandbox.restore()
redis.flushdb(done)