강동현
Builds for 1 pipeline passed in 7 minutes 59 seconds

Merge branch 'bugfix/login-missing-uuid' into develop

......@@ -77,14 +77,17 @@ export class Connection {
private handleLogin(
message: ServerInboundMessage<"login">
): ServerResponse<"login"> {
if (message.nickname.length > 12 || message.nickname.trim().length === 0) {
return { ok: false };
if (message.nickname.length > 12) {
return { ok: false, reason: "닉네임은 최대 12글자입니다." };
}
if (message.nickname.trim().length === 0) {
return { ok: false, reason: "닉네임을 공백으로 설정할 수 없습니다." };
}
this.user = new User(message.nickname, this);
// console.log(`User ${message.username} has logged in!`);
return { ok: true };
return { ok: true, result: this.user.username };
}
public handleDisconnect(): void {
......
......@@ -6,7 +6,8 @@ describe("로그인", () => {
it("닉네임으로 로그인합니다", () => {
const roomManager = new RoomManager();
const socket = new SocketTester(roomManager);
socket.testOk("login", { nickname: "guest" });
const response = socket.test("login", { nickname: "guest" });
expect(response.result !== undefined).eq(true);
expect(socket.connection.user?.nickname).eq("guest");
});
it("빈 닉네임으로 로그인할 수 없습니다", () => {
......