test: update Sidebar test to match new behavior — types with 0 notes shown

The buildDynamicSections now includes type definitions with 0 instances.
Update the 'does not show section for type with zero active entries' test
to assert the new intended behavior: types with 0 notes appear in the
sidebar as long as their Type definition entry exists (not trashed/archived).
This commit is contained in:
Test
2026-04-04 23:08:39 +02:00
parent 9fa1c52a96
commit 09e8d03851

View File

@@ -439,11 +439,13 @@ describe('Sidebar', () => {
expect(screen.queryByText('Pasta Carbonara')).not.toBeInTheDocument()
})
it('does not show section for type with zero active entries', () => {
it('shows section for type with zero active entries when type definition exists', () => {
// Only Type definitions exist for Book, no actual Book instances
// New behavior: types are shown in sidebar as long as the Type definition exists (not trashed/archived)
const entriesNoBookInstance = entriesWithCustomTypes.filter((e) => !(e.isA === 'Book' && e.title !== 'Book'))
render(<Sidebar entries={entriesNoBookInstance} selection={defaultSelection} onSelect={() => {}} />)
expect(screen.queryByText('Books')).not.toBeInTheDocument()
// Books should still appear because the Book type definition exists
expect(screen.getByText('Books')).toBeInTheDocument()
// Recipes still has an instance (Pasta Carbonara)
expect(screen.getByText('Recipes')).toBeInTheDocument()
})