Skip to content

Commit

Permalink
fix:chat test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuta-ike committed Jan 5, 2022
1 parent 916e1b9 commit 9ef660b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app/server/src/__test__/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,18 @@ describe("機能テスト", () => {
// NOTE: roomData.topics[2]のトピックが進行中になっている前提
describe("ChatItemの投稿", () => {
beforeAll(() => {
// await new Promise((resolve) =>
// adminSocket.emit(
// "ADMIN_CHANGE_TOPIC_STATE",
// {
// topicId: roomData.topics[2].id,
// state: "ongoing",
// },
// // eslint-disable-next-line @typescript-eslint/no-empty-function
// resolve,
// ),
// )

clientSockets[2].emit(
"ENTER_ROOM",
{
Expand Down Expand Up @@ -619,15 +631,15 @@ describe("機能テスト", () => {
notOnGoingTopicMessageId = uuid()

clientSockets[0].on("PUB_CHAT_ITEM", (res) => {
expect(res).toStrictEqual<PubChatItemParam>({
// NOTE: `timestamp: undefined` は存在しない
expect(res).toEqual<PubChatItemParam>({
id: notOnGoingTopicMessageId,
topicId: roomData.topics[0].id,
createdAt: MATCHING.DATE,
type: "message",
senderType: "speaker",
iconId: 3,
content: "ongoingでないトピックへの投稿",
timestamp: undefined,
})
notOnGoingTopicMessage = res
resolve()
Expand Down Expand Up @@ -880,7 +892,7 @@ describe("機能テスト", () => {
speakerTopicId: roomData.topics[0].id,
},
(res) => {
expect(res).toStrictEqual<EnterRoomResponse>({
expect(res).toEqual<EnterRoomResponse>({
result: "success",
data: {
chatItems: expect.arrayContaining(history.chatItems),
Expand Down

0 comments on commit 9ef660b

Please sign in to comment.