Better test

This commit is contained in:
Daniel Lugo 2021-12-14 13:54:14 -04:00
parent e9ccbeab20
commit 6a5b6af31f

View file

@ -13,7 +13,8 @@ const {
describe('generateRandomString()', () => { describe('generateRandomString()', () => {
it('creates a random string of the specified length', async () => { it('creates a random string of the specified length', async () => {
expect.hasAssertions() expect.hasAssertions()
const len = Math.ceil(Math.random() * 100) const base = Math.ceil(Math.random() * 100)
const len = base % 2 !== 0 ? base + 1 : base
const result = await generateRandomString(len) const result = await generateRandomString(len)
expect(result.length).toEqual(len) expect(result.length).toEqual(len)