Skip to content
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

(PC-25154)[PRO] chore: update testing-library/jest-dom #8122

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@storybook/react": "^8.1.6",
"@storybook/react-vite": "^8.1.6",
"@testing-library/cypress": "^10.0.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^14.3.1",
"@testing-library/user-event": "^14.5.2",
"@types/dompurify": "^3.0.5",
Expand Down
2 changes: 1 addition & 1 deletion pro/src/components/Callout/__specs__/Callout.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Callout', () => {
})

it('should close the Callout', async () => {
const spyClose = jest.fn()
const spyClose = vi.fn()
renderWithProviders(
<Callout {...{ ...props, closable: true, onClose: spyClose }} />
)
Expand Down
7 changes: 7 additions & 0 deletions pro/src/custom_types/axe.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'vitest'
import type { AxeMatchers } from 'vitest-axe/matchers'

declare module 'vitest' {
export interface Assertion extends AxeMatchers {}
export interface AsymmetricMatchersContaining extends AxeMatchers {}
}
4 changes: 2 additions & 2 deletions pro/src/pages/AdageIframe/app/__spec__/App.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ Object.defineProperty(window, 'matchMedia', {
writable: true,
value: () => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Object.defineProperty(window, 'matchMedia', {
writable: true,
value: () => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})

Expand Down Expand Up @@ -620,8 +620,8 @@ describe('offers', () => {
writable: true,
value: () => ({
matches: true,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})

Expand All @@ -642,8 +642,8 @@ describe('offers', () => {
writable: true,
value: () => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})
})
Expand Down Expand Up @@ -679,8 +679,8 @@ describe('offers', () => {
writable: true,
value: () => ({
matches: true,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})

Expand Down Expand Up @@ -713,8 +713,8 @@ describe('offers', () => {
writable: true,
value: () => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})
})
Expand All @@ -724,8 +724,8 @@ describe('offers', () => {
writable: true,
value: () => ({
matches: true,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})
vi.spyOn(apiAdage, 'getCollectiveOfferTemplates').mockResolvedValueOnce({
Expand All @@ -747,8 +747,8 @@ describe('offers', () => {
writable: true,
value: () => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Object.defineProperty(window, 'matchMedia', {
writable: true,
value: () => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
addListener: vi.fn(),
removeListener: vi.fn(),
}),
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ describe('AdagePagination', () => {

it('should log on click next page and previous page', async () => {
vi.spyOn(instantSearch, 'usePagination').mockImplementation(() => ({
createURL: jest.fn((page) => `/page=${page}`),
refine: jest.fn(),
createURL: vi.fn((page) => `/page=${page}`),
refine: vi.fn(),
canRefine: true,
currentRefinement: 1,
nbHits: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ describe('src | components | pages | Signup | validation', () => {
})
})

afterEach(vi.resetAllMocks)

it('should redirect to home page if the user is logged in', () => {
const validateUser = vi.spyOn(api, 'validateUser')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { renderWithProviders } from 'utils/renderWithProviders'
import { DownloadBookingsModal } from '../DownloadBookingsModal'

const MOCK_OFFER_ID = 1
const mockLogEvent = jest.fn()
const mockLogEvent = vi.fn()

const render = (priceCategoryAndScheduleCountByDate: EventDatesInfos) => {
renderWithProviders(
Expand Down
5 changes: 2 additions & 3 deletions pro/src/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'regenerator-runtime/runtime'
import { expect, vi } from 'vitest'
import { vi, expect } from 'vitest'
import '@testing-library/jest-dom/vitest'
import * as matchers from 'vitest-axe/matchers'
import '@testing-library/jest-dom'
import createFetchMock from 'vitest-fetch-mock'
import 'vitest-canvas-mock'

expect.extend(matchers)

const fetchMock = createFetchMock(vi)
fetchMock.enableMocks()
fetchMock.mockResponse((req) => {
Expand Down
Loading
Loading