mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
chore: use generator for range utility (#8825)
* chore: use generator for range utility * chore: update doc examples * chore: fix spelling * chore: fix typo Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2,11 +2,15 @@ import { describe, test, expect } from 'vitest';
|
||||
import { range } from '../src/index.js';
|
||||
|
||||
describe('range', () => {
|
||||
test('GIVEN valid range THEN valid array is returned', () => {
|
||||
expect(range(0, 5)).toEqual([0, 1, 2, 3, 4, 5]);
|
||||
test('GIVEN valid range and then valid numbers are returned', () => {
|
||||
expect([...range(5)]).toEqual([0, 1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
test('GIVEN valid range with step THEN valid array is returned', () => {
|
||||
expect(range(0, 10, 2)).toEqual([0, 2, 4, 6, 8, 10]);
|
||||
test('GIVEN valid range with start and end THEN valid numbers are returned', () => {
|
||||
expect([...range({ start: 0, end: 5 })]).toEqual([0, 1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
test('GIVEN valid range with start, end and step THEN valid numbers are returned', () => {
|
||||
expect([...range({ start: 0, end: 11, step: 2 })]).toEqual([0, 2, 4, 6, 8, 10]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user