Mocha and Chai test fails when testing function with setInterval
问题 I'm new to TDD and working with Mocha and Chai. I have created a test that passes when a value is increased, but when that increase is put within a setInterval, it fails. The objective of this code is to have something move across the screen. function startMovingThing(){ var position = setInterval(function() { moveThing(10); }, 100); } function moveThing(number){ thing.position += number; thingOnScreen.style.left = thing.position + 'px'; } test: describe('Thing', function() { it('should