강동현

로그인 성공시 username이 반환되지 않던 문제 해결

...@@ -84,7 +84,7 @@ export class Connection { ...@@ -84,7 +84,7 @@ export class Connection {
84 this.user = new User(message.nickname, this); 84 this.user = new User(message.nickname, this);
85 // console.log(`User ${message.username} has logged in!`); 85 // console.log(`User ${message.username} has logged in!`);
86 86
87 - return { ok: true }; 87 + return { ok: true, result: this.user.username };
88 } 88 }
89 89
90 public handleDisconnect(): void { 90 public handleDisconnect(): void {
......
...@@ -6,7 +6,8 @@ describe("로그인", () => { ...@@ -6,7 +6,8 @@ describe("로그인", () => {
6 it("닉네임으로 로그인합니다", () => { 6 it("닉네임으로 로그인합니다", () => {
7 const roomManager = new RoomManager(); 7 const roomManager = new RoomManager();
8 const socket = new SocketTester(roomManager); 8 const socket = new SocketTester(roomManager);
9 - socket.testOk("login", { nickname: "guest" }); 9 + const response = socket.test("login", { nickname: "guest" });
10 + expect(response.result !== undefined).eq(true);
10 expect(socket.connection.user?.nickname).eq("guest"); 11 expect(socket.connection.user?.nickname).eq("guest");
11 }); 12 });
12 it("빈 닉네임으로 로그인할 수 없습니다", () => { 13 it("빈 닉네임으로 로그인할 수 없습니다", () => {
......