wip: migrate to bun

This commit is contained in:
jdalton
2023-09-16 14:47:50 -07:00
parent 2da024c3b4
commit 97d4a2fe19
1052 changed files with 30244 additions and 26856 deletions

30
test/shuffle.spec.ts Normal file
View File

@@ -0,0 +1,30 @@
import assert from 'node:assert';
import lodashStable from 'lodash';
import shuffle from '../src/shuffle';
describe('shuffle', () => {
const array = [1, 2, 3],
object = { a: 1, b: 2, c: 3 };
it('should return a new array', () => {
assert.notStrictEqual(shuffle(array), array);
});
it('should contain the same elements after a collection is shuffled', () => {
assert.deepStrictEqual(shuffle(array).sort(), array);
assert.deepStrictEqual(shuffle(object).sort(), array);
});
it('should shuffle small collections', () => {
const actual = lodashStable.times(1000, () => shuffle([1, 2]));
assert.deepStrictEqual(lodashStable.sortBy(lodashStable.uniqBy(actual, String), '0'), [
[1, 2],
[2, 1],
]);
});
it('should treat number values for `collection` as empty', () => {
assert.deepStrictEqual(shuffle(1), []);
});
});