Skip to content

Commit

Permalink
fix(core): cannot find namespace 'vi' (#8282)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin authored Jan 15, 2025
1 parent d351c5f commit 3a3cc58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {defineField, defineType} from '@sanity/types'
import {beforeEach, expect, test, vi} from 'vitest'
import {beforeEach, expect, type Mock, test, vi} from 'vitest'

import {createSchema} from '../../../../schema/createSchema'
import {createImmutableReconcile} from '../immutableReconcile'

const immutableReconcile = createImmutableReconcile({decorator: vi.fn})

beforeEach(() => {
;(immutableReconcile as vi.Mock).mockClear()
;(immutableReconcile as Mock).mockClear()
})

test('it preserves previous value if shallow equal', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
timer,
} from 'rxjs'
import {buffer, publish, takeWhile} from 'rxjs/operators'
import {beforeEach, describe, expect, it, vi} from 'vitest'
import {beforeEach, describe, expect, it, type Mock, vi} from 'vitest'

import {createMockSanityClient} from '../../../../../../test/mocks/mockSanityClient'
import {getFallbackLocaleSource} from '../../../../i18n/fallback'
Expand All @@ -21,7 +21,7 @@ import {editState, type EditStateFor} from './editState'
import {validation} from './validation'

// Mock `./editState`
const mockEditState = editState as vi.Mock<typeof editState>
const mockEditState = editState as Mock<typeof editState>
vi.mock('./editState', () => ({editState: vi.fn()}))

const schema = createSchema({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {render, waitFor} from '@testing-library/react'
import {defineConfig, type SanityClient, unstable_useValuePreview as useValuePreview} from 'sanity'
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'
import {afterEach, beforeEach, describe, expect, it, type MockedFunction, vi} from 'vitest'

import {createMockSanityClient} from '../../../../../../test/mocks/mockSanityClient'
import {createTestProvider} from '../../../../../../test/testUtils/TestProvider'
Expand Down Expand Up @@ -33,8 +33,8 @@ vi.mock('sanity', async () => {
})

describe('DocumentHeaderTitle', () => {
const mockUseDocumentPane = useDocumentPane as vi.MockedFunction<typeof useDocumentPane>
const mockUseValuePreview = useValuePreview as vi.MockedFunction<typeof useValuePreview>
const mockUseDocumentPane = useDocumentPane as MockedFunction<typeof useDocumentPane>
const mockUseValuePreview = useValuePreview as MockedFunction<typeof useValuePreview>

const defaultProps = {
connectionState: 'connected',
Expand Down

0 comments on commit 3a3cc58

Please # to comment.