mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
modified delete() tests
This commit is contained in:
parent
8929ddb5d7
commit
d6816e06b1
1 changed files with 20 additions and 2 deletions
|
|
@ -139,10 +139,28 @@ describe('Rooms', () => {
|
|||
// TODO : add update() test
|
||||
|
||||
it('should delete existing room', async () => {
|
||||
collection.deleteOne.mockReturnValue({ id: '123456' });
|
||||
const result = await roomRepo.delete('123456');
|
||||
const mongoObjectID = new ObjectId();
|
||||
const roomID = '123456';
|
||||
|
||||
collection.deleteOne.mockResolvedValue({
|
||||
deletedCount: 1,
|
||||
});
|
||||
|
||||
const result = await roomRepo.delete(roomID);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not delete un-existing room', async () => {
|
||||
const mongoObjectID = new ObjectId();
|
||||
const roomID = '123456';
|
||||
|
||||
collection.deleteOne.mockResolvedValue({
|
||||
deletedCount: 0,
|
||||
});
|
||||
|
||||
const result = await roomRepo.delete(roomID);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue