Skip to content

Commit

Permalink
tests for rerenders
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskmnds committed Oct 1, 2024
1 parent af7cbb2 commit a6e1ade
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,29 @@ describe( 'useSignUpTracking', () => {
} );
} );

it( 'records the calypso_signup_start event a single time if dependencies are stable', () => {
const { rerender } = render( {
flow: {
...signUpFlow,
} satisfies Flow,
} );

rerender();
expect( recordSignupStart ).toHaveBeenCalledTimes( 1 );
} );

it( 'records the calypso_signup_start event multiple times when dependencies change', () => {
const { rerender } = render( {
flow: {
...signUpFlow,
useSignupStartEventProps: () => ( { extra: 'props' } ),
} satisfies Flow,
} );

rerender();
expect( recordSignupStart ).toHaveBeenCalledTimes( 2 );
} );

it( 'sets the signup-start timer only on initial mount (assuming static flowName and isSignupFlow)', () => {
const { rerender } = render( {
flow: {
Expand Down

0 comments on commit a6e1ade

Please sign in to comment.