|
| 1 | +const count = require('.'); |
| 2 | + |
| 3 | +describe('count', () => { |
| 4 | + it('Should count', () => { |
| 5 | + expect(count()).to.equal('1st'); |
| 6 | + expect(count()).to.equal('2nd'); |
| 7 | + }); |
| 8 | + it('Should continue to count', () => { |
| 9 | + expect(count()).to.equal('3rd'); |
| 10 | + expect(count()).to.equal('4th'); |
| 11 | + }); |
| 12 | + it('Should reset to 0', () => { |
| 13 | + expect(count()).to.equal('5th'); |
| 14 | + count.reset(); |
| 15 | + expect(count()).to.equal('1st'); |
| 16 | + }); |
| 17 | + it('Should set to given number', () => { |
| 18 | + expect(count()).to.equal('2nd'); |
| 19 | + count.set(6); |
| 20 | + expect(count()).to.equal('7th'); |
| 21 | + }); |
| 22 | + it('Should start from given number', () => { |
| 23 | + expect(count()).to.equal('8th'); |
| 24 | + expect(count.from(6)).to.equal('7th'); |
| 25 | + }); |
| 26 | + it('Should count down', () => { |
| 27 | + expect(count.down()).to.equal('6th'); |
| 28 | + expect(count.down()).to.equal('5th'); |
| 29 | + }); |
| 30 | + it('Should count negative numbers', () => { |
| 31 | + count.reset(); |
| 32 | + expect(count.down()).to.equal('-1st'); |
| 33 | + expect(count.down()).to.equal('-2nd'); |
| 34 | + }); |
| 35 | +}); |
0 commit comments