(spyRunner, ms, spyCancel)
| 13 | // Command that we use to test commandRunner functionality. |
| 14 | class SpyCommand extends AbstractCommand { |
| 15 | constructor (spyRunner, ms, spyCancel) { |
| 16 | super() |
| 17 | this.run = () => sleep(ms).then(spyRunner) |
| 18 | |
| 19 | // We can also spy on cancel calls. |
| 20 | if (typeof spyCancel === 'function') { |
| 21 | this.cancel = promise => { |
| 22 | promise.cancel() |
| 23 | spyCancel() |
| 24 | return Promise.resolve() |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | describe('commandRunner', () => { |