Skip to content

Commit

Permalink
test(structure): fix wrong return value of mocked usePerspective
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Feb 11, 2025
1 parent 2869a8a commit d98b230
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {act, render, screen, waitFor} from '@testing-library/react'
import {defineConfig, useSearchState} from 'sanity'
import {defineConfig, type PerspectiveContextValue, useSearchState} from 'sanity'
import {type DocumentListPaneNode, type StructureToolContextValue} from 'sanity/structure'
import {describe, expect, it, type Mock, vi} from 'vitest'

Expand Down Expand Up @@ -27,7 +27,15 @@ vi.mock('sanity', async (importOriginal) => ({
...(await importOriginal()),
useSearchState: vi.fn(),
useActiveReleases: vi.fn(() => ({})),
usePerspective: vi.fn(() => ({perspective: undefined})),
usePerspective: vi.fn(
(): PerspectiveContextValue => ({
perspectiveStack: [],
excludedPerspectives: [],
selectedPerspective: 'drafts',
selectedPerspectiveName: undefined,
selectedReleaseId: undefined,
}),
),
}))
vi.mock('sanity/router', async (importOriginal) => ({
...(await importOriginal()),
Expand Down

0 comments on commit d98b230

Please sign in to comment.