feat(tests): fix unit tests and ts linting

This commit is contained in:
perf3ct 2025-10-04 14:20:27 -07:00
parent c78fa4c8be
commit 16daadc3e7
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
2 changed files with 39 additions and 13 deletions

View File

@ -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>
)}

View File

@ -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>
)
}