fix: reconcile physique targeting for queued posts
This commit is contained in:
1 parent
d0a8bd0e2f
commit
d8d635e1ee
10 files changed
+250
-12
No files matched your search
@@ -357,6 +357,58 @@ describe('RedditApiClient', () => {
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('detects a configured seller platform in structured social links', async () => {
|
||||
const get = vi.fn().mockResolvedValue({
|
||||
data: {
|
||||
data: {
|
||||
subreddit: { public_description: 'Just me', over_18: true },
|
||||
social_links: [{ title: 'My OnlyFans', outbound_url: 'https://onlyfans.com/example' }],
|
||||
},
|
||||
},
|
||||
});
|
||||
vi.mocked(axios.create).mockReturnValue({ get } as any);
|
||||
const client2 = new RedditApiClient(getTestConfig(), logger);
|
||||
|
||||
await expect(client2.isSellerProfile('testuser', ['onlyfans'], ['onlyfans.com']))
|
||||
.resolves.toBe(true);
|
||||
expect(get).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('detects a narrow NSFW link-to-more funnel when Reddit omits the social link', async () => {
|
||||
const get = vi.fn().mockResolvedValue({
|
||||
data: {
|
||||
data: {
|
||||
subreddit: {
|
||||
public_description: "Hit the link to see more of me, we both know why you're here",
|
||||
title: '',
|
||||
display_name_prefixed: 'u/testuser',
|
||||
over_18: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
vi.mocked(axios.create).mockReturnValue({ get } as any);
|
||||
const client2 = new RedditApiClient(getTestConfig(), logger);
|
||||
|
||||
await expect(client2.isSellerProfile('testuser', ['onlyfans'], ['onlyfans.com']))
|
||||
.resolves.toBe(true);
|
||||
expect(get).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('does not treat an ordinary or non-NSFW profile link as a seller funnel', async () => {
|
||||
const get = vi.fn()
|
||||
.mockResolvedValueOnce({
|
||||
data: { data: { subreddit: { public_description: 'Hit the link to see more of my art', over_18: false } } },
|
||||
})
|
||||
.mockResolvedValueOnce({ data: { data: { children: [] } } });
|
||||
vi.mocked(axios.create).mockReturnValue({ get } as any);
|
||||
const client2 = new RedditApiClient(getTestConfig(), logger);
|
||||
|
||||
await expect(client2.isSellerProfile('testuser', ['onlyfans'], ['onlyfans.com']))
|
||||
.resolves.toBe(false);
|
||||
expect(get).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('returns false when no keywords match', async () => {
|
||||
const mockResponse = {
|
||||
data: {
|
||||
|
||||
Reference in new issue
Block a user