mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 21:00:09 +00:00
Update README quick-start and adjust tests
Add a Quick Start docker-compose snippet and simplify the Manual Setup instruction in README; also replace three screenshot assets. Update multiple audiobook component tests to match recent UI changes: adjust expected button/notification text (e.g. 'Sign in to Request', 'Request created!'), change selectors for close/interactive controls, add PreferencesContext mock, reflect processing overlay and pending/denied status behavior, and update skeleton loader count (8 -> 10). These edits keep tests aligned with the current UI and improve getting-started docs.
This commit is contained in:
@@ -55,7 +55,7 @@ describe('AudiobookCard', () => {
|
||||
|
||||
render(<AudiobookCard audiobook={baseAudiobook} />);
|
||||
|
||||
const requestButton = screen.getByRole('button', { name: 'Login to Request' });
|
||||
const requestButton = screen.getByRole('button', { name: 'Sign in to Request' });
|
||||
expect(requestButton).toBeDisabled();
|
||||
expect(createRequestMock).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -79,12 +79,12 @@ describe('AudiobookCard', () => {
|
||||
expect(createRequestMock).toHaveBeenCalledWith(baseAudiobook);
|
||||
expect(onRequestSuccess).toHaveBeenCalled();
|
||||
|
||||
expect(screen.getByText(/Request created successfully/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/Request created!/)).toBeInTheDocument();
|
||||
|
||||
await act(async () => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(screen.queryByText(/Request created successfully/)).toBeNull();
|
||||
expect(screen.queryByText(/Request created!/)).toBeNull();
|
||||
});
|
||||
|
||||
it('shows in-library state when available', async () => {
|
||||
@@ -116,11 +116,11 @@ describe('AudiobookCard', () => {
|
||||
/>
|
||||
);
|
||||
|
||||
const button = screen.getByRole('button', { name: 'Processing...' });
|
||||
expect(button).toBeDisabled();
|
||||
// Processing status is shown as a div overlay, not a button
|
||||
expect(screen.getByText('Processing')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows pending approval status with requester name', async () => {
|
||||
it('shows pending status for awaiting_approval requests', async () => {
|
||||
const { AudiobookCard } = await import('@/components/audiobooks/AudiobookCard');
|
||||
|
||||
render(
|
||||
@@ -134,10 +134,12 @@ describe('AudiobookCard', () => {
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByRole('button', { name: /Pending Approval \(alice\)/ })).toBeDisabled();
|
||||
// Card shows "Requested" for all pending statuses
|
||||
expect(screen.getByText('Requested')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows a denied request state', async () => {
|
||||
it('allows re-requesting for denied status', async () => {
|
||||
authState.user = { id: 'user-1', username: 'user' };
|
||||
const { AudiobookCard } = await import('@/components/audiobooks/AudiobookCard');
|
||||
|
||||
render(
|
||||
@@ -146,7 +148,8 @@ describe('AudiobookCard', () => {
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByRole('button', { name: 'Request Denied' })).toBeDisabled();
|
||||
// Denied status allows re-requesting, so Request button is shown
|
||||
expect(screen.getByRole('button', { name: 'Request' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows an error when a request fails', async () => {
|
||||
|
||||
Reference in New Issue
Block a user