Toggle navigation
Toggle navigation
This project
Loading...
Sign in
강동현
/
nodejs-game
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
강동현
2021-06-10 00:08:26 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c3add0370ad4f10627ec927b21896a8f83aa6b12
c3add037
1 parent
d9424f2e
chat이 유저의 닉네임을 보내도록 변경
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
server/room/Room.ts
server/test/chat.test.ts
server/room/Room.ts
View file @
c3add03
...
...
@@ -215,7 +215,7 @@ export class Room {
}
public
sendChat
(
user
:
User
,
message
:
string
):
void
{
this
.
broadcast
(
"chat"
,
{
sender
:
user
.
user
name
,
message
:
message
});
this
.
broadcast
(
"chat"
,
{
sender
:
user
.
nick
name
,
message
:
message
});
}
private
updateUserStatus
(
user
:
User
)
{
...
...
server/test/chat.test.ts
View file @
c3add03
...
...
@@ -27,7 +27,7 @@ describe("채팅", () => {
}
=
prepareJoinedRoom
(
1
);
socket
.
testOk
(
"chat"
,
{
message
:
"Hello World"
});
});
it
(
"
자신을 제외한 다른 사람들이
채팅을 받습니다"
,
()
=>
{
it
(
"
모두가
채팅을 받습니다"
,
()
=>
{
const
{
sockets
:
[
socket1
,
socket2
],
users
:
[
user1
,
user2
],
...
...
@@ -35,9 +35,13 @@ describe("채팅", () => {
socket1
.
testOk
(
"chat"
,
{
message
:
"Hello World"
});
expect
(
socket1
.
socket
.
received
(
"chat"
)).
deep
.
eq
({
message
:
"Hello World"
,
sender
:
user1
.
nickname
,
});
expect
(
socket2
.
socket
.
received
(
"chat"
)).
deep
.
eq
({
message
:
"Hello World"
,
sender
:
user1
.
user
name
,
sender
:
user1
.
nick
name
,
});
});
it
(
"빈 채팅은 보낼 수 없습니다"
,
()
=>
{
...
...
Please
register
or
login
to post a comment