Initial Commit

This commit is contained in:
2025-08-16 14:17:46 -04:00
commit 651a21a035
49 changed files with 1347 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import {describe, beforeAll, it, expect} from 'bun:test';
import {Strings} from '../../src/strings';
const randomStringCount = 11;
describe('When generating random strings', () => {
it('generates a random string', () => {
const randomString = Strings.random();
expect(typeof randomString).toBe('string');
expect(randomString.length).toBeGreaterThan(0);
});
describe('Given a length argument', () => {
const length = 4;
it('generates a random string of the given length', () => {
const randomString = Strings.random(length);
expect(typeof randomString).toBe('string');
expect(randomString.length).toBeGreaterThan(0);
expect(randomString.length).toBe(length);
});
});
describe(`Given [${randomStringCount}] are generated`, () => {
let randomStrings;
beforeAll(() => {
randomStrings = Array.from({length: randomStringCount}, () => Strings.random());
});
it('generates random strings such that no strings are identical', () => {
const uniqueRandomStrings = new Set(randomStrings);
expect(uniqueRandomStrings.size).toBe(randomStringCount);
});
});
});