Created
March 20, 2018 08:56
-
-
Save weekens/5bd8ebb6c7d2d73b2f8554aeeb59d323 to your computer and use it in GitHub Desktop.
Unit test for prime finder actor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('PrimeFinderActor', () => { | |
it('should correctly find next prime', () => { | |
const pf = new PrimeFinderActor(); | |
expect(pf.nextPrime(1)).to.be.equal(2); | |
expect(pf.nextPrime(2)).to.be.equal(3); | |
expect(pf.nextPrime(3)).to.be.equal(5); | |
expect(pf.nextPrime(30)).to.be.equal(31); | |
}); | |
it('should only accept positive numbers', () => { | |
const pf = new PrimeFinderActor(); | |
expect(() => pf.nextPrime(0)).to.throw(); | |
expect(() => pf.nextPrime(-1)).to.throw(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment