mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(collection): reduce reduce's code (#9581)
* refactor(collection): reduce `reduce`'s code * fix: resolved bug in tests --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -700,12 +700,17 @@ describe('reduce() tests', () => {
|
||||
|
||||
test('reduce collection into a single value with initial value', () => {
|
||||
const sum = coll.reduce((a, x) => a + x, 0);
|
||||
expect(sum).toStrictEqual(6);
|
||||
expect<number>(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce collection into a single value without initial value', () => {
|
||||
const sum = coll.reduce<number>((a, x) => a + x);
|
||||
expect(sum).toStrictEqual(6);
|
||||
const sum = coll.reduce((a, x) => a + x);
|
||||
expect<number>(sum).toStrictEqual(6);
|
||||
});
|
||||
|
||||
test('reduce empty collection with initial value', () => {
|
||||
const coll = createCollection();
|
||||
expect(coll.reduce((a, x) => a + x, 0)).toStrictEqual(0);
|
||||
});
|
||||
|
||||
test('reduce empty collection without initial value', () => {
|
||||
|
||||
Reference in New Issue
Block a user