Skip to content

Commit

Permalink
test(useInfiniteScroll): 스크롤을 끝까지 내리지 않은 상태와 스크롤을 끝까지 내린 상태 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
jyh071116 committed Jan 11, 2024
1 parent 07d7a7a commit d2d77b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hooks/useInfiniteScroll.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ describe("useInfiniteScroll", () => {
Object.defineProperty(document.documentElement, "offsetHeight", {
value: 3000,
});

// 스크롤을 끝까지 내리지 않음
fireEvent.scroll(window);
// 스크롤을 끝까지 내림
window.scrollY = 3000;

fireEvent.scroll(window);
expect(fetchNextPage).toHaveBeenCalled();

expect(fetchNextPage).toHaveBeenCalledTimes(1);
});
});

0 comments on commit d2d77b6

Please sign in to comment.