Getting rid of roomId in Message class (this is not needed since all messages sent are for the room we are currently in)
This commit is contained in:
parent
4d1c3517ec
commit
3b6ace03fa
5 changed files with 13 additions and 35 deletions
|
@ -3,32 +3,17 @@ import {Message} from "../src/Model/Websocket/Message";
|
|||
|
||||
describe("Message Model", () => {
|
||||
it("should find userId and roomId", () => {
|
||||
let message = {userId: "test1", roomId: "test2", name: "foo", character: "user"};
|
||||
let message = {userId: "test1", name: "foo", character: "user"};
|
||||
let messageObject = new Message(message);
|
||||
expect(messageObject.userId).toBe("test1");
|
||||
expect(messageObject.roomId).toBe("test2");
|
||||
expect(messageObject.name).toBe("foo");
|
||||
expect(messageObject.character).toBe("user");
|
||||
})
|
||||
|
||||
it("should find throw error when no userId", () => {
|
||||
let message = {roomId: "test2"};
|
||||
let message = {};
|
||||
expect(() => {
|
||||
let messageObject = new Message(message);
|
||||
}).toThrow(new Error("userId or roomId cannot be null"));
|
||||
});
|
||||
|
||||
it("should find throw error when no roomId", () => {
|
||||
let message = {userId: "test1"};
|
||||
expect(() => {
|
||||
let messageObject = new Message(message);
|
||||
}).toThrow(new Error("userId or roomId cannot be null"));
|
||||
});
|
||||
|
||||
it("should find throw error when no roomId", () => {
|
||||
let message = {name: "foo"};
|
||||
expect(() => {
|
||||
let messageObject = new Message(message);
|
||||
}).toThrow(new Error("userId or roomId cannot be null"));
|
||||
}).toThrow(new Error("userId cannot be null"));
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue