Showing
2 changed files
with
7 additions
and
3 deletions
... | @@ -215,7 +215,7 @@ export class Room { | ... | @@ -215,7 +215,7 @@ export class Room { |
215 | } | 215 | } |
216 | 216 | ||
217 | public sendChat(user: User, message: string): void { | 217 | public sendChat(user: User, message: string): void { |
218 | - this.broadcast("chat", { sender: user.username, message: message }); | 218 | + this.broadcast("chat", { sender: user.nickname, message: message }); |
219 | } | 219 | } |
220 | 220 | ||
221 | private updateUserStatus(user: User) { | 221 | private updateUserStatus(user: User) { | ... | ... |
... | @@ -27,7 +27,7 @@ describe("채팅", () => { | ... | @@ -27,7 +27,7 @@ describe("채팅", () => { |
27 | } = prepareJoinedRoom(1); | 27 | } = prepareJoinedRoom(1); |
28 | socket.testOk("chat", { message: "Hello World" }); | 28 | socket.testOk("chat", { message: "Hello World" }); |
29 | }); | 29 | }); |
30 | - it("자신을 제외한 다른 사람들이 채팅을 받습니다", () => { | 30 | + it("모두가 채팅을 받습니다", () => { |
31 | const { | 31 | const { |
32 | sockets: [socket1, socket2], | 32 | sockets: [socket1, socket2], |
33 | users: [user1, user2], | 33 | users: [user1, user2], |
... | @@ -35,9 +35,13 @@ describe("채팅", () => { | ... | @@ -35,9 +35,13 @@ describe("채팅", () => { |
35 | 35 | ||
36 | socket1.testOk("chat", { message: "Hello World" }); | 36 | socket1.testOk("chat", { message: "Hello World" }); |
37 | 37 | ||
38 | + expect(socket1.socket.received("chat")).deep.eq({ | ||
39 | + message: "Hello World", | ||
40 | + sender: user1.nickname, | ||
41 | + }); | ||
38 | expect(socket2.socket.received("chat")).deep.eq({ | 42 | expect(socket2.socket.received("chat")).deep.eq({ |
39 | message: "Hello World", | 43 | message: "Hello World", |
40 | - sender: user1.username, | 44 | + sender: user1.nickname, |
41 | }); | 45 | }); |
42 | }); | 46 | }); |
43 | it("빈 채팅은 보낼 수 없습니다", () => { | 47 | it("빈 채팅은 보낼 수 없습니다", () => { | ... | ... |
-
Please register or login to post a comment