diff --git a/src/components/panel/AnswerList.tsx b/src/components/panel/AnswerList.tsx new file mode 100644 index 0000000..62ec88d --- /dev/null +++ b/src/components/panel/AnswerList.tsx @@ -0,0 +1,37 @@ +import type { Answer } from '@/lib/api/answer'; + +import React from 'react'; + +import { Account } from '@/components/vectors'; +import { formatDistance } from '@/lib/format-date'; + +interface Props { + nickname: string; + answers: Answer[]; + now: Date; +} +export function AnswerList({ nickname, answers, now }: Props): JSX.Element { + return ( + + ); +} diff --git a/src/components/panel/__tests__/AnswerList.test.tsx b/src/components/panel/__tests__/AnswerList.test.tsx new file mode 100644 index 0000000..ec2c499 --- /dev/null +++ b/src/components/panel/__tests__/AnswerList.test.tsx @@ -0,0 +1,25 @@ +import type { Answer } from '@/lib/api/answer'; + +import React from 'react'; + +import { render, screen } from '@testing-library/react'; + +import { createMockAnswer } from '@/mocks/data/answer'; + +import { AnswerList } from '../AnswerList'; + +describe('AnswerList', () => { + it('답변 내용과 답변자 닉네임을 보여준다', () => { + const answers: Answer[] = [ + { ...createMockAnswer(), content: '안녕하세요' }, + { ...createMockAnswer(), content: '반가워요' }, + ]; + render( + , + ); + + expect(screen.getByText(/안녕하세요/)).toBeInTheDocument(); + expect(screen.getByText(/반가워요/)).toBeInTheDocument(); + expect(screen.getByText(/닉네임/)).toBeInTheDocument(); + }); +});