mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
feat(REST): dynamic rate limit offsets (#10099)
* feat(REST): dynamic rate limit offsets * chore: update tests * chore: better doc comment Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * fix: don't overlook globalReset Co-authored-by: ckohen <chaikohen@gmail.com> --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: ckohen <chaikohen@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { MockAgent, setGlobalDispatcher, type Interceptable } from 'undici';
|
||||
import { beforeEach, afterEach, test, expect } from 'vitest';
|
||||
import { REST } from '../src/index.js';
|
||||
import { normalizeRateLimitOffset } from '../src/lib/utils/utils.js';
|
||||
import { genPath } from './util.js';
|
||||
|
||||
const api = new REST();
|
||||
@@ -36,5 +37,5 @@ test('no token', async () => {
|
||||
test('negative offset', () => {
|
||||
const badREST = new REST({ offset: -5_000 });
|
||||
|
||||
expect(badREST.options.offset).toEqual(0);
|
||||
expect(normalizeRateLimitOffset(badREST.options.offset, 'hehe :3')).toEqual(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user