هذا الالتزام موجود في:
2026-04-20 15:12:16 +03:00
التزام 28f7241bcd
172 ملفات معدلة مع 21907 إضافات و0 حذوفات

عرض الملف

@@ -0,0 +1,30 @@
import { LikesService } from './likes.service';
describe('LikesService', () => {
it('returns liked false from status when target post no longer exists', async () => {
const likesRepository = {
findOne: jest.fn(),
};
const postsRepository = {
findById: jest.fn().mockResolvedValue(null),
};
const commentsRepository = {
findById: jest.fn(),
};
const service = new LikesService(
likesRepository as any,
postsRepository as any,
commentsRepository as any,
);
await expect(
service.getStatus('user-1', { targetId: '507f1f77bcf86cd799439011', targetType: 'post' }),
).resolves.toEqual({
liked: false,
targetId: '507f1f77bcf86cd799439011',
targetType: 'post',
});
expect(likesRepository.findOne).not.toHaveBeenCalled();
});
});