الملفات
back_end_oudelaa/src/modules/likes/likes.service.spec.ts
boutmoun123 5bd5e19a89
فشلت بعض الفحوصات
/ deploy (push) Failing after 1m22s
feat: expand backend admin marketplace and scaling
2026-05-14 16:44:07 +03:00

33 أسطر
935 B
TypeScript

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,
{ bumpGlobalVersion: jest.fn() } as any,
{ createLikeNotification: jest.fn() } 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();
});
});