Compare commits

..

No commits in common. "e4739468ba2d3403ea7a00f0e0839b9e5711b231" and "eb3e06f5d3fffc075fb62abd74196d7816c3eaf0" have entirely different histories.

View file

@ -190,31 +190,28 @@ describe("Rooms", () => {
describe("roomExists", () => { describe("roomExists", () => {
it("should return true if room exists", async () => { it("should return true if room exists", async () => {
const title = "TEST ROOM"; const title = "test room";
const userId = '66fc70bea1b9e87655cf17c9';
collection.findOne.mockResolvedValue({ title, userId }); collection.findOne.mockResolvedValue({ title });
const result = await rooms.roomExists(title, userId); const result = await rooms.roomExists(title);
expect(db.connect).toHaveBeenCalled(); expect(db.connect).toHaveBeenCalled();
expect(db.collection).toHaveBeenCalledWith("rooms"); expect(db.collection).toHaveBeenCalledWith("rooms");
expect(collection.findOne).toHaveBeenCalledWith({ title: title.toUpperCase(), userId }); expect(collection.findOne).toHaveBeenCalledWith({ title });
expect(result).toBe(true); expect(result).toBe(true);
}); });
it("should return false if room does not exist", async () => { it("should return false if room does not exist", async () => {
const title = "NONEXISTENT ROOM"; const title = "nonexistent room";
const userId = '66fc70bea1b9e87655cf17c9';
collection.findOne.mockResolvedValue(null); collection.findOne.mockResolvedValue(null);
const result = await rooms.roomExists(title, userId); const result = await rooms.roomExists(title);
expect(db.connect).toHaveBeenCalled(); expect(db.connect).toHaveBeenCalled();
expect(db.collection).toHaveBeenCalledWith('rooms'); expect(db.collection).toHaveBeenCalledWith('rooms');
expect(collection.findOne).toHaveBeenCalledWith({ title: title.toUpperCase(), userId }); expect(collection.findOne).toHaveBeenCalledWith({ title });
expect(result).toBe(false); expect(result).toBeFalsy();
}); });
}); });