mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore(deps): bump the npm-dependencies group across 1 directory with 55 updates (#33170)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import Operations from '../operations'
|
||||
|
||||
@ -355,16 +356,14 @@ describe('Operations', () => {
|
||||
})
|
||||
|
||||
it('should show rename modal when rename is clicked', async () => {
|
||||
const user = userEvent.setup()
|
||||
render(<Operations {...defaultProps} />)
|
||||
await openPopover()
|
||||
const renameButton = screen.getByText('datasetDocuments.list.table.rename')
|
||||
await act(async () => {
|
||||
fireEvent.click(renameButton)
|
||||
})
|
||||
// Rename modal should be shown
|
||||
await waitFor(() => {
|
||||
expect(screen.getByDisplayValue('Test Document')).toBeInTheDocument()
|
||||
})
|
||||
const renameAction = screen.getByText('datasetDocuments.list.table.rename').parentElement as HTMLElement
|
||||
await user.click(renameAction)
|
||||
|
||||
const renameInput = await screen.findByRole('textbox')
|
||||
expect(renameInput).toHaveValue('Test Document')
|
||||
})
|
||||
|
||||
it('should call sync for notion data source', async () => {
|
||||
|
||||
@ -5,6 +5,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { ToastContext } from '@/app/components/base/toast/context'
|
||||
import { ProcessMode } from '@/models/datasets'
|
||||
import * as datasetsService from '@/service/datasets'
|
||||
import * as useDataset from '@/service/knowledge/use-dataset'
|
||||
@ -13,8 +14,22 @@ import { IndexingType } from '../../../../create/step-two'
|
||||
import { DocumentContext } from '../../context'
|
||||
import EmbeddingDetail from '../index'
|
||||
|
||||
const { mockNotify, mockClose } = vi.hoisted(() => ({
|
||||
mockNotify: vi.fn(),
|
||||
mockClose: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('@/service/datasets')
|
||||
vi.mock('@/service/knowledge/use-dataset')
|
||||
vi.mock('@/app/components/base/toast/context', async () => {
|
||||
const { createContext } = await vi.importActual<typeof import('use-context-selector')>('use-context-selector')
|
||||
return {
|
||||
ToastContext: createContext({
|
||||
notify: mockNotify,
|
||||
close: mockClose,
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
const mockFetchIndexingStatus = vi.mocked(datasetsService.fetchIndexingStatus)
|
||||
const mockPauseDocIndexing = vi.mocked(datasetsService.pauseDocIndexing)
|
||||
@ -32,9 +47,11 @@ const createWrapper = (contextValue: DocumentContextValue = { datasetId: 'ds1',
|
||||
const queryClient = createTestQueryClient()
|
||||
return ({ children }: { children: ReactNode }) => (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<DocumentContext.Provider value={contextValue}>
|
||||
{children}
|
||||
</DocumentContext.Provider>
|
||||
<ToastContext.Provider value={{ notify: mockNotify, close: vi.fn() }}>
|
||||
<DocumentContext.Provider value={contextValue}>
|
||||
{children}
|
||||
</DocumentContext.Provider>
|
||||
</ToastContext.Provider>
|
||||
</QueryClientProvider>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user