Migrate from Jest to Vitest (#34454)

This commit is contained in:
Echo 2025-05-07 20:29:02 +02:00 committed by GitHub
parent 741f166407
commit 8c579c5b34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 2344 additions and 2003 deletions

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<AutosuggestEmoji /> renders emoji with custom url 1`] = `
exports[`<AutosuggestEmoji /> > renders emoji with custom url 1`] = `
<div
className="autosuggest-emoji"
>
@ -17,7 +17,7 @@ exports[`<AutosuggestEmoji /> renders emoji with custom url 1`] = `
</div>
`;
exports[`<AutosuggestEmoji /> renders native emoji 1`] = `
exports[`<AutosuggestEmoji /> > renders native emoji 1`] = `
<div
className="autosuggest-emoji"
>

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Avatar /> Autoplay renders a animated avatar 1`] = `
exports[`<Avatar /> > Autoplay > renders a animated avatar 1`] = `
<div
className="account__avatar account__avatar--loading"
onMouseEnter={[Function]}
@ -21,7 +21,7 @@ exports[`<Avatar /> Autoplay renders a animated avatar 1`] = `
</div>
`;
exports[`<Avatar /> Still renders a still avatar 1`] = `
exports[`<Avatar /> > Still > renders a still avatar 1`] = `
<div
className="account__avatar account__avatar--loading"
onMouseEnter={[Function]}

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<AvatarOverlay renders a overlay avatar 1`] = `
exports[`<AvatarOverlay > renders a overlay avatar 1`] = `
<div
className="account__avatar-overlay"
onMouseEnter={[Function]}

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<Button /> adds class "button-secondary" if props.secondary given 1`] = `
exports[`<Button /> > adds class "button-secondary" if props.secondary given 1`] = `
<button
className="button button-secondary"
onClick={[Function]}
@ -8,7 +8,7 @@ exports[`<Button /> adds class "button-secondary" if props.secondary given 1`] =
/>
`;
exports[`<Button /> renders a button element 1`] = `
exports[`<Button /> > renders a button element 1`] = `
<button
className="button"
onClick={[Function]}
@ -16,7 +16,7 @@ exports[`<Button /> renders a button element 1`] = `
/>
`;
exports[`<Button /> renders a disabled attribute if props.disabled given 1`] = `
exports[`<Button /> > renders a disabled attribute if props.disabled given 1`] = `
<button
className="button"
disabled={true}
@ -25,7 +25,7 @@ exports[`<Button /> renders a disabled attribute if props.disabled given 1`] = `
/>
`;
exports[`<Button /> renders class="button--block" if props.block given 1`] = `
exports[`<Button /> > renders class="button--block" if props.block given 1`] = `
<button
className="button button--block"
onClick={[Function]}
@ -33,7 +33,7 @@ exports[`<Button /> renders class="button--block" if props.block given 1`] = `
/>
`;
exports[`<Button /> renders the children 1`] = `
exports[`<Button /> > renders the children 1`] = `
<button
className="button"
onClick={[Function]}
@ -45,7 +45,7 @@ exports[`<Button /> renders the children 1`] = `
</button>
`;
exports[`<Button /> renders the given text 1`] = `
exports[`<Button /> > renders the given text 1`] = `
<button
className="button"
onClick={[Function]}
@ -55,7 +55,7 @@ exports[`<Button /> renders the given text 1`] = `
</button>
`;
exports[`<Button /> renders the props.text instead of children 1`] = `
exports[`<Button /> > renders the props.text instead of children 1`] = `
<button
className="button"
onClick={[Function]}

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<DisplayName /> renders display name + account name 1`] = `
exports[`<DisplayName /> > renders display name + account name 1`] = `
<span
className="display-name"
onMouseEnter={[Function]}

View file

@ -21,7 +21,7 @@ describe('<Button />', () => {
});
it('handles click events using the given handler', () => {
const handler = jest.fn();
const handler = vi.fn();
render(<Button onClick={handler}>button</Button>);
fireEvent.click(screen.getByText('button'));
@ -29,7 +29,7 @@ describe('<Button />', () => {
});
it('does not handle click events if props.disabled given', () => {
const handler = jest.fn();
const handler = vi.fn();
render(<Button onClick={handler} disabled>button</Button>);
fireEvent.click(screen.getByText('button'));