login.test.ts
970 Bytes
import { expect } from "chai";
import { RoomManager } from "../room/RoomManager";
import { SocketTester } from "./util/SocketTester";
describe("로그인", () => {
it("닉네임으로 로그인합니다", () => {
const roomManager = new RoomManager();
const socket = new SocketTester(roomManager);
socket.testOk("login", { nickname: "guest" });
expect(socket.connection.user?.nickname).eq("guest");
});
it("빈 닉네임으로 로그인할 수 없습니다", () => {
const roomManager = new RoomManager();
const socket = new SocketTester(roomManager);
socket.testNotOk("login", { nickname: "" });
socket.testNotOk("login", { nickname: " " });
});
it("닉네임은 최대 12자입니다", () => {
const roomManager = new RoomManager();
const socket = new SocketTester(roomManager);
socket.testNotOk("login", { nickname: "a".repeat(13) });
socket.testNotOk("login", { nickname: "가".repeat(13) });
});
});