-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fe,be/feature/#456 web rtc test code작성 #466
Merged
The head ref may contain hidden characters: "FE,BE/feature/#456-WebRTC-TestCode\uC791\uC131"
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8d57495
feat: WebRTC 시그널서버 테스트코드 일부작성
Doosies 2a4fdf1
test: WebRTC 이벤트게이트웨이 유닛테스트 코드
Doosies 32df273
fix: eventsGateway joinRoom이벤트 수정
Doosies c19e879
test: signaling server testcode 알아보기 쉽도록 변경함
Doosies dbe3377
chore: vitest 설치, 설정 완료
Doosies b2ee3d0
refactor: 리뷰 반영
Doosies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const loggerServiceMock = { | ||
debug: jest.fn(), | ||
info: jest.fn(), | ||
warn: jest.fn(), | ||
error: jest.fn(), | ||
fatal: jest.fn(), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { guestSocketMock, hostSocketMock } from './socket.mock'; | ||
|
||
type Room = { | ||
roomId: string; | ||
password: string; | ||
wrongRoomId: string; | ||
wrongPassword: string; | ||
}; | ||
|
||
export const roomMock: Room = { | ||
roomId: 'testRoomId', | ||
password: 'testPassword', | ||
wrongRoomId: 'wrongRoomId', | ||
wrongPassword: 'wrongPassword', | ||
}; | ||
|
||
export const createRoomMock = (users: string[]) => ({ | ||
[roomMock.roomId]: { | ||
users, | ||
password: roomMock.password, | ||
}, | ||
}); | ||
|
||
export const twoPeopleInsideRoomMock = () => | ||
createRoomMock([hostSocketMock.id, guestSocketMock.id]); | ||
export const onlyGuestInsideRoomMock = () => | ||
createRoomMock([guestSocketMock.id]); | ||
export const onlyHostInsideRoomMock = () => createRoomMock([hostSocketMock.id]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export type SocketMock = { | ||
id: string; | ||
emit: jest.Mock; | ||
join: jest.Mock; | ||
to: jest.Mock; | ||
}; | ||
|
||
export const toRoomEmitMock = jest.fn(); | ||
|
||
export const guestSocketMock: SocketMock = { | ||
id: 'testGuestSocketId', | ||
emit: jest.fn(), | ||
join: jest.fn(), | ||
to: jest.fn().mockImplementation(() => ({ emit: toRoomEmitMock })), | ||
}; | ||
|
||
export const hostSocketMock: SocketMock = { | ||
id: 'testHostSocketId', | ||
emit: jest.fn(), | ||
join: jest.fn(), | ||
to: jest.fn().mockImplementation(() => ({ emit: toRoomEmitMock })), | ||
}; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { guestSocketMock, hostSocketMock } from './socket.mock'; | ||
|
||
type User = { | ||
roomId: string; | ||
role: 'host' | 'guest'; | ||
}; | ||
|
||
export const hostUserMock: User = { | ||
roomId: 'testRoomId', | ||
role: 'host', | ||
}; | ||
export const guestUserMock: User = { | ||
roomId: 'testRoomId', | ||
role: 'guest', | ||
}; | ||
|
||
export const twoPeopleInsideUsersMock = () => | ||
createUsersMock([ | ||
{ id: hostSocketMock.id, user: hostUserMock }, | ||
{ id: guestSocketMock.id, user: guestUserMock }, | ||
]); | ||
export const onlyGuestInsideUsersMock = () => | ||
createUsersMock([{ id: guestSocketMock.id, user: guestUserMock }]); | ||
export const onlyHostInsideUsersMock = () => | ||
createUsersMock([{ id: hostSocketMock.id, user: hostUserMock }]); | ||
|
||
export const createUsersMock = (mock: Array<{ id: string; user: User }>) => | ||
mock.reduce((acc, { id, user }) => ({ ...acc, [id]: user }), {}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 이런 식으로 mock 파일들 모아놓는 거 참고 많이 했어!