Update tests

This commit is contained in:
Paul Kaplan 2021-05-17 15:31:08 -04:00
parent cc66341252
commit 53414e11a9

View file

@ -7,10 +7,14 @@ describe('Studio comments', () => {
const loadComments = jest.fn(); const loadComments = jest.fn();
const component = mountWithIntl( const component = mountWithIntl(
<StudioComments <StudioComments
hasFetchedSession={false}
comments={[]} comments={[]}
handleLoadMoreComments={loadComments} handleLoadMoreComments={loadComments}
/> />
); );
expect(loadComments).not.toHaveBeenCalled();
component.setProps({hasFetchedSession: true});
component.update();
expect(loadComments).toHaveBeenCalled(); expect(loadComments).toHaveBeenCalled();
// When updated to have comments, load is not called again // When updated to have comments, load is not called again
@ -30,6 +34,7 @@ describe('Studio comments', () => {
const resetComments = jest.fn(); const resetComments = jest.fn();
const component = mountWithIntl( const component = mountWithIntl(
<StudioComments <StudioComments
hasFetchedSession
isAdmin={false} isAdmin={false}
comments={[{id: 123, author: {}}]} comments={[{id: 123, author: {}}]}
handleResetComments={resetComments} handleResetComments={resetComments}
@ -57,6 +62,7 @@ describe('Studio comments', () => {
mountWithIntl( mountWithIntl(
<StudioComments <StudioComments
isAdmin isAdmin
hasFetchedSession
comments={[{id: 123, author: {}}]} comments={[{id: 123, author: {}}]}
handleResetComments={resetComments} handleResetComments={resetComments}
/> />