test(routes): expand home page coverage
Adds reader stats rendering and reader grid layout when isReader=true. 2 new tests targeting reader-mode branches. Refs #496. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,4 +91,35 @@ describe('home page (/)', () => {
|
||||
const section = document.querySelector('section[aria-label]');
|
||||
expect(section).not.toBeNull();
|
||||
});
|
||||
|
||||
it('renders the reader stats counts when isReader is true and stats are provided', async () => {
|
||||
render(HomePage, {
|
||||
props: {
|
||||
data: baseData({
|
||||
isReader: true,
|
||||
user: { firstName: 'Anna' },
|
||||
readerStats: { totalDocuments: 50, totalPersons: 20, totalStories: 5 }
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
expect(document.body.textContent).toContain('50');
|
||||
expect(document.body.textContent).toContain('20');
|
||||
});
|
||||
|
||||
it('renders ReaderRecentDocs and ReaderRecentStories grid in reader view', async () => {
|
||||
render(HomePage, {
|
||||
props: {
|
||||
data: baseData({
|
||||
isReader: true,
|
||||
user: { firstName: 'Anna' },
|
||||
recentDocs: [],
|
||||
recentStories: []
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
const grids = document.querySelectorAll('.grid.grid-cols-1');
|
||||
expect(grids.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user