mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
fix tests
This commit is contained in:
parent
323efca180
commit
e4739468ba
1 changed files with 17 additions and 17 deletions
|
|
@ -193,13 +193,13 @@ describe("Rooms", () => {
|
||||||
const title = "TEST ROOM";
|
const title = "TEST ROOM";
|
||||||
const userId = '66fc70bea1b9e87655cf17c9';
|
const userId = '66fc70bea1b9e87655cf17c9';
|
||||||
|
|
||||||
collection.findOne.mockResolvedValue({ title });
|
collection.findOne.mockResolvedValue({ title, userId });
|
||||||
|
|
||||||
const result = await rooms.roomExists(title);
|
const result = await rooms.roomExists(title, userId);
|
||||||
|
|
||||||
expect(db.connect).toHaveBeenCalled();
|
expect(db.connect).toHaveBeenCalled();
|
||||||
expect(db.collection).toHaveBeenCalledWith("rooms");
|
expect(db.collection).toHaveBeenCalledWith("rooms");
|
||||||
expect(collection.findOne).toHaveBeenCalledWith({ title });
|
expect(collection.findOne).toHaveBeenCalledWith({ title: title.toUpperCase(), userId });
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -209,12 +209,12 @@ describe("Rooms", () => {
|
||||||
|
|
||||||
collection.findOne.mockResolvedValue(null);
|
collection.findOne.mockResolvedValue(null);
|
||||||
|
|
||||||
const result = await rooms.roomExists(title);
|
const result = await rooms.roomExists(title, userId);
|
||||||
|
|
||||||
expect(db.connect).toHaveBeenCalled();
|
expect(db.connect).toHaveBeenCalled();
|
||||||
expect(db.collection).toHaveBeenCalledWith('rooms');
|
expect(db.collection).toHaveBeenCalledWith('rooms');
|
||||||
expect(collection.findOne).toHaveBeenCalledWith({ title });
|
expect(collection.findOne).toHaveBeenCalledWith({ title: title.toUpperCase(), userId });
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue