mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-27 12:08:18 +00:00
14 lines
423 B
TypeScript
14 lines
423 B
TypeScript
|
import { shuffle } from "../../assets/Scripts/Services/Utils/ArrayUtils";
|
||
|
|
||
|
test("shuffle shuffles the array", () => {
|
||
|
const array: number[] = [0, 1, 2, 3, 4, 5, 6];
|
||
|
const shuffledArray: number[] = shuffle(array);
|
||
|
|
||
|
let positionsShuffled = 0;
|
||
|
for (let i = 0; i < shuffledArray.length; i++) {
|
||
|
if (shuffledArray[i] != i) positionsShuffled++;
|
||
|
}
|
||
|
|
||
|
expect(positionsShuffled).toBeGreaterThan(3);
|
||
|
});
|