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-05-26 21:12:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
32316719b475c128252f75bdef9020b8af7a2614
32316719
1 parent
1ef3174e
간단한 테스트 로직 작성
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletions
server/package.json
server/test.test.ts
server/yarn.lock
server/package.json
View file @
3231671
{
"dependencies"
:
{
"@types/chai"
:
"^4.2.18"
,
"@types/express"
:
"^4.17.11"
,
"@types/mocha"
:
"^8.2.2"
,
"@types/node"
:
"^15.3.1"
,
"@types/socket.io"
:
"^3.0.2"
,
"@types/socket.io-client"
:
"^3.0.0"
,
"@types/uuid"
:
"^8.3.0"
,
"chai"
:
"^4.3.4"
,
"express"
:
"^4.17.1"
,
"mocha"
:
"^8.4.0"
,
"nodemon"
:
"^2.0.7"
,
"socket.io"
:
"^4.1.2"
,
"socket.io-client"
:
"^4.1.2"
,
"ts-node"
:
"^9.1.1"
,
"typescript"
:
"^4.2.4"
,
"uuid"
:
"^8.3.2"
},
"scripts"
:
{
"start"
:
"nodemon index.ts"
"start"
:
"nodemon index.ts"
,
"test"
:
"mocha -r ts-node/register ./**/*.test.ts"
}
}
...
...
server/test.test.ts
0 → 100644
View file @
3231671
import
ioclient
,
{
Socket
}
from
"socket.io-client"
;
import
{
MessageResponse
,
MessageType
}
from
"./message/types"
;
import
{
expect
}
from
"chai"
;
import
{
Server
}
from
"./Server"
;
describe
(
"server"
,
()
=>
{
const
PORT
=
3000
;
var
server
:
Server
;
var
client
:
Socket
;
before
((
done
)
=>
{
client
=
ioclient
(
`http://localhost:
${
PORT
}
`
);
client
.
on
(
"connect"
,
done
);
server
=
new
Server
(
3000
);
});
after
(()
=>
{
server
.
close
();
client
.
close
();
});
it
(
"login"
,
(
done
)
=>
{
client
.
emit
(
MessageType
.
LOGIN
,
{
username
:
"guest"
},
(
response
:
MessageResponse
)
=>
{
expect
(
response
.
ok
).
to
.
equals
(
true
);
done
();
}
);
});
});
server/yarn.lock
View file @
3231671
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment