DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
test(web): stabilize learning library async assertions
XZH0125acbfd647
diff --git a/web/tests/learning-library-workspaces.spec.tsx b/web/tests/learning-library-workspaces.spec.tsxindex 3042a38a0..3d22288c2 100644--- a/web/tests/learning-library-workspaces.spec.tsx+++ b/web/tests/learning-library-workspaces.spec.tsx@@ -1,5 +1,5 @@import React from 'react'-import { fireEvent, render, screen, waitFor } from '@testing-library/react'+import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'import { beforeEach, expect, it, vi } from 'vitest'import { useLearningCreation } from '@/components/learning/LibraryWorkspace'import { ActivityLibrary } from '@/components/learning/ActivityLibrary'@@ -45,11 +45,21 @@ it('opens creation after client navigation even before window.location reflectsexpect(mocks.replace).toHaveBeenCalledWith('/learning/books?dt_workspace=other', { scroll: false })})it('keeps equal practice IDs in separate workspaces and filters without changing write scope', async () => {- mocks.library.mockResolvedValue({ items: [+ const libraryResult = { items: [{ id: 1, question: 'Original question', content_workspace_id: '', content_workspace_name: 'Default workspace' },{ id: 1, question: 'Other question', content_workspace_id: 'other', content_workspace_name: 'Other' },- ], unavailable_workspaces: [] })+ ], unavailable_workspaces: [] }+ let libraryPromise!: Promise<typeof libraryResult>+ let resolveLibrary!: (result: typeof libraryResult) => void+ mocks.library.mockImplementation(() => {+ libraryPromise = new Promise(resolve => { resolveLibrary = resolve })+ return libraryPromise+ })render(<ActivityLibrary kind="practice" onCreate={vi.fn()} />)+ await act(async () => {+ resolveLibrary(libraryResult)+ await libraryPromise.then(() => Promise.resolve())+ })expect(await screen.findByRole('link', { name: /Original question/ })).toHaveAttribute('href', '/learning/practice?store=1&question=1&dt_workspace=')expect(screen.getByRole('link', { name: /Other question/ })).toHaveAttribute('href', '/learning/practice?store=1&question=1&dt_workspace=other')fireEvent.change(screen.getByLabelText('Filter by workspace'), { target: { value: 'other' } })