secsan/test/shuffle.test.ts

15 lines
418 B
TypeScript
Raw Normal View History

2022-11-10 11:00:40 +00:00
import { expect, test } from 'vitest';
import { buildNameMap } from '../src/shuffle';
test('shuffle does not include matching pairs', () => {
2022-11-10 14:58:38 +00:00
const names = Array(10)
.fill(null)
.map((_, i) => `Test ${i}`);
2022-11-10 11:00:40 +00:00
for (let i = 0; i < 50000; i++) {
const shuffled = buildNameMap(names);
for (const pair of shuffled) {
expect(pair[0]).not.toBe(pair[1]);
}
}
});