corriger tests brisés

supprimer tests de contenu de salle (copier-coller des tests de dossier je crois)
This commit is contained in:
C. Fuhrman 2025-02-26 13:06:03 -05:00
parent d584374347
commit 784ac277d0

View file

@ -119,41 +119,6 @@ describe('Rooms', () => {
}); });
}); });
// write a test for getContent
describe('getContent', () => {
it('should return the content of a room', async () => {
const roomId = '60c72b2f9b1d8b3a4c8e4d3b';
const content = [
{ title: 'salle 1', content: [] },
{ title: 'salle 2', content: [] },
];
// Mock the database response
collection.find().toArray.mockResolvedValue(content);
const result = await rooms.getContent(roomId);
expect(db.connect).toHaveBeenCalled();
expect(db.collection).toHaveBeenCalledWith('files');
expect(collection.find).toHaveBeenCalledWith({ roomId });
expect(result).toEqual(content);
});
it('should return an empty array if the room has no content', async () => {
const roomId = '60c72b2f9b1d8b3a4c8e4d3b';
// Mock the database response
collection.find().toArray.mockResolvedValue([]);
const result = await rooms.getContent(roomId);
expect(db.connect).toHaveBeenCalled();
expect(db.collection).toHaveBeenCalledWith('files');
expect(collection.find).toHaveBeenCalledWith({ roomId });
expect(result).toEqual([]);
});
});
describe('delete', () => { describe('delete', () => {
it('should delete a room and return true', async () => { it('should delete a room and return true', async () => {
const roomId = '60c72b2f9b1d8b3a4c8e4d3b'; const roomId = '60c72b2f9b1d8b3a4c8e4d3b';