Skip to content

Commit a7d197e

Browse files
authored
Merge pull request #279 from aniokedianne/fix/275-creator-detail-empty-social-links-test
Add integration test for empty creator detail social links
2 parents 23dc60a + b8dfd53 commit a7d197e

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { getCreatorProfile } from './creator-profile.service';
2+
3+
const findFirstMock = jest.fn();
4+
5+
jest.mock('../../utils/prisma.utils', () => ({
6+
prisma: {
7+
creatorProfile: {
8+
findFirst: (...args: unknown[]) => findFirstMock(...args),
9+
},
10+
},
11+
}));
12+
13+
describe('creator detail integration - empty social links', () => {
14+
beforeEach(() => {
15+
findFirstMock.mockReset();
16+
});
17+
18+
it('returns links as an empty array when creator profile is missing', async () => {
19+
findFirstMock.mockResolvedValue(null);
20+
21+
const result = await getCreatorProfile('missing-creator');
22+
23+
expect(Array.isArray(result.links)).toBe(true);
24+
expect(result.links).toEqual([]);
25+
});
26+
27+
it('returns links as an empty array when social links are absent in database payload', async () => {
28+
findFirstMock.mockResolvedValue({
29+
id: 'creator-1',
30+
displayName: 'Creator One',
31+
bio: 'Bio',
32+
avatarUrl: 'https://example.com/avatar.png',
33+
perks: [],
34+
});
35+
36+
const result = await getCreatorProfile('creator-1');
37+
38+
expect(Array.isArray(result.links)).toBe(true);
39+
expect(result.links).toEqual([]);
40+
});
41+
});

0 commit comments

Comments
 (0)