Skip to content

Commit

Permalink
fix: type for identifyHotjar userId arg
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinLuc committed Jan 12, 2024
1 parent 82a3c83 commit f1da271
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ describe('Tests useHotjar', () => {
});
});

it('should identifyHotjar for De-identified users', () => {
const { result } = renderHook(() => useHotjar());
const identifyHotjarSpy = jest.spyOn(result.current, 'identifyHotjar');
const { identifyHotjar } = result.current;

identifyHotjar(null, {
ab_test: 'variant-A',
});

expect(identifyHotjarSpy).toHaveBeenCalledWith(null, {
ab_test: 'variant-A',
});
});

it('should stateChange with new relative path', () => {
const { result } = renderHook(() => useHotjar());
const stateChangeSpy = jest.spyOn(result.current, 'stateChange');
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface IUseHotjar {
logCallback?: (...data: unknown[]) => void
) => boolean;
identifyHotjar: (
userId: string,
userId: string | null,
userInfo: TUserInfo,
logCallback?: (...data: unknown[]) => void
) => boolean;
Expand Down

0 comments on commit f1da271

Please sign in to comment.