Reduce Reddit profile screening requests
This commit is contained in:
1 parent
3d015c4e80
commit
1833e94a10
4 files changed
+97
-37
No files matched your search
@@ -364,6 +364,18 @@ describe('RedditApiClient', () => {
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it('propagates profile rate limits so the main loop backs off', async () => {
|
||||
const error = {
|
||||
isAxiosError: true,
|
||||
response: { status: 429, headers: { 'retry-after': '42' } },
|
||||
};
|
||||
vi.mocked(axios.create).mockReturnValue({ get: vi.fn().mockRejectedValue(error) } as any);
|
||||
|
||||
const client2 = new RedditApiClient(getTestConfig(), logger);
|
||||
await expect(client2.isSellerProfile('testuser', ['onlyfans']))
|
||||
.rejects.toMatchObject({ retryAfterMs: 42_000 });
|
||||
});
|
||||
|
||||
it('returns true when a domain in the bio matches sellerDomains', async () => {
|
||||
const mockResponse = {
|
||||
data: {
|
||||
|
||||
Reference in new issue
Block a user