Add moduleNameMapper for shared lib mocks in Jest

Create dedicated mock files for shared/lib modules and map them
in moduleNameMapper for reliable module resolution in CI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-18 03:40:46 +03:00
parent b8b5addf0e
commit fcfd126698
4 changed files with 69 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
// Mock for shared/lib/referral.ts
module.exports = {
initiateReferral: jest.fn(() => Promise.resolve()),
getPendingReferral: jest.fn(() => Promise.resolve(null)),
getReferralCount: jest.fn(() => Promise.resolve(0)),
getReferralInfo: jest.fn(() => Promise.resolve(null)),
calculateReferralScore: jest.fn(() => 0),
getReferralStats: jest.fn(() => Promise.resolve({ totalReferred: 0, pendingCount: 0, confirmedCount: 0 })),
getMyReferrals: jest.fn(() => Promise.resolve([])),
subscribeToReferralEvents: jest.fn(() => jest.fn()),
};