-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: integrate testing #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion that I think is worth implementing before merging but otherwise changes seem reasonable
export function getUtf8ByteLength(text: string): number { | ||
return new TextEncoder().encode(text).length | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe outside the scope of this PR but would eventually move this to something likerenderer/lib/text.ts
vi.mock('@tanstack/react-router', () => ({ | ||
useNavigate: vi.fn(() => { | ||
return { navigate: vi.fn() } | ||
}), | ||
createFileRoute: vi.fn(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return (options: any) => ({ component: options.component }) // Mocked implementation | ||
}), | ||
Outlet: () => <div>Mocked Outlet</div>, | ||
})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for my understanding, this has to be done for each test that relies on the router in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it depends. I think short answer yes. long answer, if we want to test actual navigation actions, we need to stub out the router instead of just stubbing out the function inside the router.
I think more work needs to go into creating our mocks and stubs, but this just allows it run (its was basically a smoke screen test for jsdom)
Sets up vitetest and React Testing Library