fix: update unit tests

This commit is contained in:
yassinedorbozgithub
2024-12-04 08:47:57 +01:00
parent 32f3dc8271
commit 6cbedcbc16
20 changed files with 92 additions and 52 deletions

View File

@@ -26,8 +26,8 @@ import {
import { Content, ContentModel } from '../schemas/content.schema';
import {
installContentFixtures,
contentFixtures,
installContentFixtures,
} from './../../utils/test/fixtures/content';
import { ContentRepository } from './content.repository';
@@ -63,7 +63,7 @@ describe('ContentRepository', () => {
const content = await contentModel.findOne({ title: 'Jean' });
const contentType = await contentTypeModel.findById(content.entity);
const result = await contentRepository.findOneAndPopulate(content.id);
expect(findSpy).toHaveBeenCalledWith(content.id);
expect(findSpy).toHaveBeenCalledWith(content.id, undefined);
expect(result).toEqualPayload({
...contentFixtures.find(({ title }) => title === 'Jean'),
entity: contentTypeFixtures.find(

View File

@@ -84,7 +84,7 @@ describe('ContentService', () => {
const content = await contentService.findOne({ title: 'Jean' });
const contentType = await contentTypeService.findOne(content.entity);
const result = await contentService.findOneAndPopulate(content.id);
expect(findSpy).toHaveBeenCalledWith(content.id);
expect(findSpy).toHaveBeenCalledWith(content.id, undefined);
expect(result).toEqualPayload({
...contentFixtures.find(({ title }) => title === 'Jean'),
entity: contentType,