mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-07 04:38:18 +08:00
Ship folder-based workspaces and data migration, daily practice, redesigned provider and model settings, and streaming conversation improvements. Synchronize README translations and document the archive/permanent-delete upgrade behavior in assets/releases/ver1-6-9.md. Reduce initial JavaScript by deduplicating English resources and loading animation features after hydration. Keep the existing route size budgets. Update regression fixtures and browser audits for scoped URLs and the new settings and learning interfaces.
27 lines
925 B
TypeScript
27 lines
925 B
TypeScript
import React from 'react'
|
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
import { expect, it, vi } from 'vitest'
|
|
import BookLibrary from '@/app/(workspace)/learning/books/components/BookLibrary'
|
|
vi.mock('react-i18next', () => ({
|
|
useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),
|
|
}))
|
|
it('a failed book list offers retry without claiming the library is empty', () => {
|
|
const retry = vi.fn()
|
|
render(
|
|
<BookLibrary
|
|
books={[]}
|
|
loading={false}
|
|
error="Failed to load books"
|
|
onRetry={retry}
|
|
canCreate={false}
|
|
onNewBook={vi.fn()}
|
|
onSelectBook={vi.fn()}
|
|
onDeleteBook={vi.fn()}
|
|
/>
|
|
)
|
|
expect(screen.getByRole('alert')).toHaveTextContent('Failed to load books')
|
|
expect(screen.queryByText('No books yet')).toBeNull()
|
|
fireEvent.click(screen.getByRole('button', { name: 'Retry' }))
|
|
expect(retry).toHaveBeenCalledOnce()
|
|
})
|