|
@@ -1,8 +1,8 @@
|
|
|
import { useState } from 'react'
|
|
import { useState } from 'react'
|
|
|
-import { type Table } from '@tanstack/react-table'
|
|
|
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
import { render } from 'vitest-browser-react'
|
|
import { render } from 'vitest-browser-react'
|
|
|
import { userEvent } from 'vitest/browser'
|
|
import { userEvent } from 'vitest/browser'
|
|
|
|
|
+import { createTableMock } from '@/test-utils/tanstack-table'
|
|
|
import { TasksMultiDeleteDialog } from './tasks-multi-delete-dialog'
|
|
import { TasksMultiDeleteDialog } from './tasks-multi-delete-dialog'
|
|
|
|
|
|
|
|
vi.mock('@/lib/utils', async (orig) => ({
|
|
vi.mock('@/lib/utils', async (orig) => ({
|
|
@@ -10,16 +10,6 @@ vi.mock('@/lib/utils', async (orig) => ({
|
|
|
sleep: vi.fn(() => Promise.resolve()),
|
|
sleep: vi.fn(() => Promise.resolve()),
|
|
|
}))
|
|
}))
|
|
|
|
|
|
|
|
-function createTableMock(rowCount = 2) {
|
|
|
|
|
- const rows = Array.from({ length: rowCount }, () => ({}))
|
|
|
|
|
- const resetRowSelection = vi.fn()
|
|
|
|
|
- const table = {
|
|
|
|
|
- getFilteredSelectedRowModel: () => ({ rows }),
|
|
|
|
|
- resetRowSelection,
|
|
|
|
|
- } as unknown as Table<Record<string, unknown>>
|
|
|
|
|
- return { table, resetRowSelection }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
describe('TasksMultiDeleteDialog', () => {
|
|
describe('TasksMultiDeleteDialog', () => {
|
|
|
beforeEach(() => vi.clearAllMocks())
|
|
beforeEach(() => vi.clearAllMocks())
|
|
|
|
|
|