Last active
March 12, 2019 03:27
-
-
Save gunar/9851b191e48315296ed3626d78e28c77 to your computer and use it in GitHub Desktop.
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
// Property-based test | |
describe('properties', () => { | |
it('is a bijection', () => { | |
fc.assert(fc.property( | |
fc.integer(1, Number.MAX_SAFE_INTEGER), | |
seed => decode(encode(seed)) === seed | |
)) | |
}); | |
}) | |
// Example-based test | |
describe('record locator module', () => { | |
it('should encode integers into record locator strings', () => { | |
recordLocator.encode(270600).should.equal('AAAA'); | |
recordLocator.encode(1048575).should.equal('ZZZZ'); | |
recordLocator.encode(345560).should.equal('DKHR'); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment