From 5ab87616c190c34ff430ba16be64b4301e31a691 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 16 Sep 2023 15:16:59 -0500 Subject: [PATCH] vitest: jest --> vi --- app/soapbox/__tests__/toast.test.tsx | 2 +- app/soapbox/actions/__tests__/compose.test.ts | 4 ++-- app/soapbox/actions/__tests__/me.test.ts | 4 ++-- app/soapbox/actions/__tests__/onboarding.test.ts | 12 ++++++------ .../ui/button/__tests__/button.test.tsx | 4 ++-- .../ui/datepicker/__tests__/datepicker.test.tsx | 8 ++++---- .../components/ui/form/__tests__/form.test.tsx | 4 ++-- .../components/ui/modal/__tests__/modal.test.tsx | 12 ++++++------ .../components/__tests__/login-form.test.tsx | 6 +++--- .../components/__tests__/chat-list-item.test.tsx | 10 +++++----- .../__tests__/chat-message-reaction.test.tsx | 12 ++++++------ .../__tests__/chat-pane-header.test.tsx | 16 ++++++++-------- .../polls/__tests__/duration-selector.test.tsx | 10 +++++----- .../__tests__/feed-carousel.test.tsx | 4 ++-- .../features/groups/__tests__/discover.test.tsx | 2 +- .../discover/__tests__/layout-buttons.test.tsx | 4 ++-- .../search/__tests__/recent-searches.test.tsx | 8 ++++---- .../discover/search/__tests__/results.test.tsx | 2 +- .../discover/search/__tests__/search.test.tsx | 6 +++--- .../modals/__tests__/landing-page-modal.test.tsx | 8 ++++---- .../modals/__tests__/unauthorized-modal.test.tsx | 8 ++++---- .../report-modal/__tests__/report-modal.test.tsx | 6 +++--- app/soapbox/hooks/__mocks__/resize-observer.ts | 2 +- 23 files changed, 77 insertions(+), 77 deletions(-) diff --git a/app/soapbox/__tests__/toast.test.tsx b/app/soapbox/__tests__/toast.test.tsx index 795c11493..bdeff2249 100644 --- a/app/soapbox/__tests__/toast.test.tsx +++ b/app/soapbox/__tests__/toast.test.tsx @@ -20,7 +20,7 @@ function renderApp() { } beforeAll(() => { - jest.spyOn(console, 'error').mockImplementation(() => {}); + vi.spyOn(console, 'error').mockImplementation(() => {}); }); afterEach(() => { diff --git a/app/soapbox/actions/__tests__/compose.test.ts b/app/soapbox/actions/__tests__/compose.test.ts index 58f83e537..f6c64c929 100644 --- a/app/soapbox/actions/__tests__/compose.test.ts +++ b/app/soapbox/actions/__tests__/compose.test.ts @@ -41,7 +41,7 @@ describe('uploadCompose()', () => { it('creates an alert if exceeds max size', async() => { const mockIntl = { - formatMessage: jest.fn().mockReturnValue('Image exceeds the current file size limit (10 Bytes)'), + formatMessage: vi.fn().mockReturnValue('Image exceeds the current file size limit (10 Bytes)'), } as unknown as IntlShape; const expectedActions = [ @@ -87,7 +87,7 @@ describe('uploadCompose()', () => { it('creates an alert if exceeds max size', async() => { const mockIntl = { - formatMessage: jest.fn().mockReturnValue('Video exceeds the current file size limit (10 Bytes)'), + formatMessage: vi.fn().mockReturnValue('Video exceeds the current file size limit (10 Bytes)'), } as unknown as IntlShape; const expectedActions = [ diff --git a/app/soapbox/actions/__tests__/me.test.ts b/app/soapbox/actions/__tests__/me.test.ts index 91fba12fa..0187ba093 100644 --- a/app/soapbox/actions/__tests__/me.test.ts +++ b/app/soapbox/actions/__tests__/me.test.ts @@ -7,10 +7,10 @@ import { AuthUserRecord, ReducerRecord } from 'soapbox/reducers/auth'; import { fetchMe, patchMe } from '../me'; -jest.mock('../../storage/kv-store', () => ({ +vi.mock('../../storage/kv-store', () => ({ __esModule: true, default: { - getItemOrError: jest.fn().mockReturnValue(Promise.resolve({})), + getItemOrError: vi.fn().mockReturnValue(Promise.resolve({})), }, })); diff --git a/app/soapbox/actions/__tests__/onboarding.test.ts b/app/soapbox/actions/__tests__/onboarding.test.ts index f786c7f90..15a10f93a 100644 --- a/app/soapbox/actions/__tests__/onboarding.test.ts +++ b/app/soapbox/actions/__tests__/onboarding.test.ts @@ -10,11 +10,11 @@ describe('checkOnboarding()', () => { }); beforeEach(() => { - mockGetItem = jest.fn().mockReturnValue(null); + mockGetItem = vi.fn().mockReturnValue(null); }); it('does nothing if localStorage item is not set', async() => { - mockGetItem = jest.fn().mockReturnValue(null); + mockGetItem = vi.fn().mockReturnValue(null); const state = rootState.setIn(['onboarding', 'needsOnboarding'], false); const store = mockStore(state); @@ -27,7 +27,7 @@ describe('checkOnboarding()', () => { }); it('does nothing if localStorage item is invalid', async() => { - mockGetItem = jest.fn().mockReturnValue('invalid'); + mockGetItem = vi.fn().mockReturnValue('invalid'); const state = rootState.setIn(['onboarding', 'needsOnboarding'], false); const store = mockStore(state); @@ -40,7 +40,7 @@ describe('checkOnboarding()', () => { }); it('dispatches the correct action', async() => { - mockGetItem = jest.fn().mockReturnValue('1'); + mockGetItem = vi.fn().mockReturnValue('1'); const state = rootState.setIn(['onboarding', 'needsOnboarding'], false); const store = mockStore(state); @@ -61,7 +61,7 @@ describe('startOnboarding()', () => { }); beforeEach(() => { - mockSetItem = jest.fn(); + mockSetItem = vi.fn(); }); it('dispatches the correct action', async() => { @@ -84,7 +84,7 @@ describe('endOnboarding()', () => { }); beforeEach(() => { - mockRemoveItem = jest.fn(); + mockRemoveItem = vi.fn(); }); it('dispatches the correct action', async() => { diff --git a/app/soapbox/components/ui/button/__tests__/button.test.tsx b/app/soapbox/components/ui/button/__tests__/button.test.tsx index 8d1f65ec9..f9c59c68a 100644 --- a/app/soapbox/components/ui/button/__tests__/button.test.tsx +++ b/app/soapbox/components/ui/button/__tests__/button.test.tsx @@ -27,7 +27,7 @@ describe('