Skip to content

Instantly share code, notes, and snippets.

@bespechnost
Created October 15, 2015 13:27
Show Gist options
  • Select an option

  • Save bespechnost/bb3e23426e2d800086b1 to your computer and use it in GitHub Desktop.

Select an option

Save bespechnost/bb3e23426e2d800086b1 to your computer and use it in GitHub Desktop.
chai = require 'chai'
spies = require 'chai-spies'
chai.use spies
CommandQueue = require '../../src/CommandQueueForNemoApps'
MockCommand = require '../mocks/MockCommandForCommandQueueSpec'
describe 'Выполнение команд', ->
it 'Execute отрабатывает один раз', (specDone) ->
commandQueue = new CommandQueue()
mockCommand1 = new MockCommand isSuccess: yes, timeout: 500, id: 1
spy = chai.spy mockCommand1
mockCommand2 = new MockCommand isSuccess: yes, timeout: 500, id: 2
mockCommand3 = new MockCommand isSuccess: yes, timeout: 500, id: 3
promise1 = commandQueue.add mockCommand1
promise2 = commandQueue.add mockCommand2
promise3 = commandQueue.add mockCommand3
promise3.fin ->
console.log m1.expects('execute').callCount
specDone()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment