Cleaning up tests
This commit is contained in:
parent
87707bc814
commit
57adc6b21c
@ -1,19 +0,0 @@
|
|||||||
import "jasmine";
|
|
||||||
import {Message} from "../src/Model/Websocket/Message";
|
|
||||||
|
|
||||||
describe("Message Model", () => {
|
|
||||||
it("should find userId and roomId", () => {
|
|
||||||
let message = {userId: "test1", name: "foo", character: "user"};
|
|
||||||
let messageObject = new Message(message);
|
|
||||||
expect(messageObject.userId).toBe("test1");
|
|
||||||
expect(messageObject.name).toBe("foo");
|
|
||||||
expect(messageObject.character).toBe("user");
|
|
||||||
})
|
|
||||||
|
|
||||||
it("should find throw error when no userId", () => {
|
|
||||||
let message = {};
|
|
||||||
expect(() => {
|
|
||||||
let messageObject = new Message(message);
|
|
||||||
}).toThrow(new Error("userId cannot be null"));
|
|
||||||
});
|
|
||||||
})
|
|
@ -1,17 +1,15 @@
|
|||||||
import "jasmine";
|
import "jasmine";
|
||||||
import {Message} from "../src/Model/Websocket/Message";
|
|
||||||
import {World, ConnectCallback, DisconnectCallback } from "../src/Model/World";
|
import {World, ConnectCallback, DisconnectCallback } from "../src/Model/World";
|
||||||
import {MessageUserPosition, Point} from "../src/Model/Websocket/MessageUserPosition";
|
import {Point} from "../src/Model/Websocket/MessageUserPosition";
|
||||||
import { Group } from "../src/Model/Group";
|
import { Group } from "../src/Model/Group";
|
||||||
import {Distance} from "../src/Model//Distance";
|
|
||||||
|
|
||||||
describe("World", () => {
|
describe("World", () => {
|
||||||
it("should connect user1 and user2", () => {
|
it("should connect user1 and user2", () => {
|
||||||
let connectCalledNumber: number = 0;
|
let connectCalledNumber: number = 0;
|
||||||
let connect = (user: string, group: Group): void => {
|
let connect: ConnectCallback = (user: string, group: Group): void => {
|
||||||
connectCalledNumber++;
|
connectCalledNumber++;
|
||||||
}
|
}
|
||||||
let disconnect = (user: string, group: Group): void => {
|
let disconnect: DisconnectCallback = (user: string, group: Group): void => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,10 +33,10 @@ describe("World", () => {
|
|||||||
|
|
||||||
it("should connect 3 users", () => {
|
it("should connect 3 users", () => {
|
||||||
let connectCalled: boolean = false;
|
let connectCalled: boolean = false;
|
||||||
let connect = (user: string, group: Group): void => {
|
let connect: ConnectCallback = (user: string, group: Group): void => {
|
||||||
connectCalled = true;
|
connectCalled = true;
|
||||||
}
|
}
|
||||||
let disconnect = (user: string, group: Group): void => {
|
let disconnect: DisconnectCallback = (user: string, group: Group): void => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,10 +62,10 @@ describe("World", () => {
|
|||||||
it("should disconnect user1 and user2", () => {
|
it("should disconnect user1 and user2", () => {
|
||||||
let connectCalled: boolean = false;
|
let connectCalled: boolean = false;
|
||||||
let disconnectCallNumber: number = 0;
|
let disconnectCallNumber: number = 0;
|
||||||
let connect = (user: string, group: Group): void => {
|
let connect: ConnectCallback = (user: string, group: Group): void => {
|
||||||
connectCalled = true;
|
connectCalled = true;
|
||||||
}
|
}
|
||||||
let disconnect = (user: string, group: Group): void => {
|
let disconnect: DisconnectCallback = (user: string, group: Group): void => {
|
||||||
disconnectCallNumber++;
|
disconnectCallNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user