
-- vi.mocked 는 타입만 붙인다 — 구현은 없다
mocked :: a -> Mocked a
mocked = unsafeCoerce -- "Just returns the object that was passed"
(mocked useSize).mockImplementation -- undefined: 원래 함수는 mock 이 아니다
-- 구현은 vi.hoisted 로 먼저 만들어 vi.mock 에 넘긴다
mockUseSize = hoisted fn
mock "ahooks" { useSize = mockUseSize }
beforeEach (mockImplementation mockUseSize (const { width = 100, height = 20 }))
-- DOM 측정값은 getter 를 바꾸고 뒤에서 복원
beforeEach (defineProperty htmlElementPrototype "scrollWidth" { configurable = True, get = 150 })
-- 측정이 복잡하면 Playwright·Cypress 통합 테스트로