feat(tests): fix unit tests and ts linting
This commit is contained in:
parent
c78fa4c8be
commit
16daadc3e7
|
|
@ -591,8 +591,8 @@ const DocumentsPage: React.FC = () => {
|
|||
}}>
|
||||
<Typography variant="body2" sx={{ flexGrow: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
{t('documents.selection.count', {
|
||||
count: selectedDocuments.size > 999 ? `${Math.floor(selectedDocuments.size/1000)}K` : selectedDocuments.size,
|
||||
total: sortedDocuments.length > 999 ? `${Math.floor(sortedDocuments.length/1000)}K` : sortedDocuments.length
|
||||
count: selectedDocuments.size,
|
||||
total: sortedDocuments.length
|
||||
})}
|
||||
</Typography>
|
||||
<Button
|
||||
|
|
@ -612,7 +612,7 @@ const DocumentsPage: React.FC = () => {
|
|||
size="small"
|
||||
color="error"
|
||||
>
|
||||
{t('documents.selection.deleteSelected', { count: selectedDocuments.size > 999 ? `${Math.floor(selectedDocuments.size/1000)}K` : selectedDocuments.size })}
|
||||
{t('documents.selection.deleteSelected', { count: selectedDocuments.size })}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,32 @@ import React from 'react'
|
|||
import { render, RenderOptions } from '@testing-library/react'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import { vi } from 'vitest'
|
||||
import { I18nextProvider } from 'react-i18next'
|
||||
import i18n from 'i18next'
|
||||
import { initReactI18next } from 'react-i18next'
|
||||
import { NotificationProvider } from '../contexts/NotificationContext'
|
||||
|
||||
// Initialize i18n for tests
|
||||
i18n
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
lng: 'en',
|
||||
fallbackLng: 'en',
|
||||
ns: ['translation'],
|
||||
defaultNS: 'translation',
|
||||
resources: {
|
||||
en: {
|
||||
translation: require('../../public/locales/en/translation.json')
|
||||
}
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false
|
||||
},
|
||||
react: {
|
||||
useSuspense: false
|
||||
}
|
||||
})
|
||||
|
||||
interface User {
|
||||
id: string
|
||||
username: string
|
||||
|
|
@ -157,13 +181,15 @@ const AllTheProviders = ({
|
|||
routerProps?: any
|
||||
}) => {
|
||||
return (
|
||||
<BrowserRouter {...routerProps}>
|
||||
<NotificationProvider>
|
||||
<MockAuthProvider mockValues={authValues}>
|
||||
{children}
|
||||
</MockAuthProvider>
|
||||
</NotificationProvider>
|
||||
</BrowserRouter>
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<BrowserRouter {...routerProps}>
|
||||
<NotificationProvider>
|
||||
<MockAuthProvider mockValues={authValues}>
|
||||
{children}
|
||||
</MockAuthProvider>
|
||||
</NotificationProvider>
|
||||
</BrowserRouter>
|
||||
</I18nextProvider>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue