Skip to content

Commit

Permalink
test: 삭제 버튼을 누르는 경우 로직에 대한 테스트코드 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
jhLim97 committed Feb 5, 2022
1 parent 36c0a9c commit ef628bc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/src/components/TransactionUpdateForm/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,20 @@ describe('TransactionUpateForm 테스트', () => {
fireEvent.click(backButton);
expect(onCancle).toHaveBeenCalled();
});

it('삭제 버튼을 누르면 onDelete 함수가 호출된다.', () => {
const onDelete = jest.fn();
render(
<TransactionUpdateForm
transaction={TEST_DATA}
onUpdate={null}
onDelete={onDelete}
onCancle={null}
/>,
);

const deleteButton = screen.getByRole('button', { name: '삭제' });
fireEvent.click(deleteButton);
expect(onDelete).toHaveBeenCalled();
});
});

0 comments on commit ef628bc

Please sign in to comment.