test: Category Feature - Tests (#88) #93

Merged
shoko merged 1 commits from feature/category-tests into main 2026-04-09 13:17:02 +02:00
Owner

Summary

Add comprehensive tests for category feature (Issue #88).

Tests Added

Category Management Tests (14 tests)

  • test_add_category_requires_admin - Permission enforcement
  • test_add_category_duplicate_slug_fails - Duplicate prevention
  • test_add_category_invalid_slug_fails_uppercase - Slug validation
  • test_add_category_invalid_slug_fails_with_numbers - Slug validation
  • test_add_category_invalid_slug_fails_with_symbols - Slug validation
  • test_add_category_invalid_slug_fails_empty - Empty slug rejection
  • test_add_category_valid - Successful creation
  • test_delete_category_soft_deletes - Soft delete behavior
  • test_deleted_category_not_listed - Exclusion from list
  • test_list_categories_empty - Empty list handling
  • test_list_categories_returns_active - Active only filtering
  • test_get_category_not_found - Non-existent handling
  • test_get_category_deleted_returns_none - Soft-deleted exclusion
  • test_add_category_requires_admin_non_existent_room - Room creation

Category-to-Bounty Tests (13 tests)

  • test_add_category_to_bounty - Adding category
  • test_add_duplicate_category_to_bounty_noop - Duplicate handling
  • test_add_category_to_bounty_invalid_bounty - Validation
  • test_add_category_to_bounty_invalid_category - Validation
  • test_remove_category_from_bounty - Removal
  • test_remove_category_not_on_bounty_returns_false - Edge case
  • test_update_bounty_categories_replace_all - Replacement
  • test_update_bounty_categories_clear_all - Clearing
  • test_update_bounty_categories_validates - Validation
  • test_add_category_to_bounty_requires_admin - Permission
  • test_remove_category_from_bounty_requires_admin - Permission
  • test_update_bounty_categories_requires_admin - Permission
  • test_delete_category_requires_admin - Permission

Testing

All 123 tests pass (96 original + 27 new).

## Summary Add comprehensive tests for category feature (Issue #88). ## Tests Added ### Category Management Tests (14 tests) - `test_add_category_requires_admin` - Permission enforcement - `test_add_category_duplicate_slug_fails` - Duplicate prevention - `test_add_category_invalid_slug_fails_uppercase` - Slug validation - `test_add_category_invalid_slug_fails_with_numbers` - Slug validation - `test_add_category_invalid_slug_fails_with_symbols` - Slug validation - `test_add_category_invalid_slug_fails_empty` - Empty slug rejection - `test_add_category_valid` - Successful creation - `test_delete_category_soft_deletes` - Soft delete behavior - `test_deleted_category_not_listed` - Exclusion from list - `test_list_categories_empty` - Empty list handling - `test_list_categories_returns_active` - Active only filtering - `test_get_category_not_found` - Non-existent handling - `test_get_category_deleted_returns_none` - Soft-deleted exclusion - `test_add_category_requires_admin_non_existent_room` - Room creation ### Category-to-Bounty Tests (13 tests) - `test_add_category_to_bounty` - Adding category - `test_add_duplicate_category_to_bounty_noop` - Duplicate handling - `test_add_category_to_bounty_invalid_bounty` - Validation - `test_add_category_to_bounty_invalid_category` - Validation - `test_remove_category_from_bounty` - Removal - `test_remove_category_not_on_bounty_returns_false` - Edge case - `test_update_bounty_categories_replace_all` - Replacement - `test_update_bounty_categories_clear_all` - Clearing - `test_update_bounty_categories_validates` - Validation - `test_add_category_to_bounty_requires_admin` - Permission - `test_remove_category_from_bounty_requires_admin` - Permission - `test_update_bounty_categories_requires_admin` - Permission - `test_delete_category_requires_admin` - Permission ## Testing All 123 tests pass (96 original + 27 new).
shoko added 1 commit 2026-04-09 13:09:14 +02:00
Tests for category feature (Issue #88):

Category Management Tests (11 tests):
- test_add_category_requires_admin
- test_add_category_duplicate_slug_fails
- test_add_category_invalid_slug_fails_uppercase
- test_add_category_invalid_slug_fails_with_numbers
- test_add_category_invalid_slug_fails_with_symbols
- test_add_category_invalid_slug_fails_empty
- test_add_category_valid
- test_delete_category_soft_deletes
- test_deleted_category_not_listed
- test_list_categories_empty
- test_list_categories_returns_active
- test_get_category_not_found
- test_get_category_deleted_returns_none
- test_add_category_requires_admin_non_existent_room

Category-to-Bounty Tests (10 tests):
- test_add_category_to_bounty
- test_add_duplicate_category_to_bounty_noop
- test_add_category_to_bounty_invalid_bounty
- test_add_category_to_bounty_invalid_category
- test_remove_category_from_bounty
- test_remove_category_not_on_bounty_returns_false
- test_update_bounty_categories_replace_all
- test_update_bounty_categories_clear_all
- test_update_bounty_categories_validates
- test_add_category_to_bounty_requires_admin
- test_remove_category_from_bounty_requires_admin
- test_update_bounty_categories_requires_admin
- test_delete_category_requires_admin

All 123 tests pass (96 original + 27 new)
han approved these changes 2026-04-09 13:16:42 +02:00
han left a comment
Collaborator

lgtm

lgtm
shoko merged commit 7e0bc1f8a3 into main 2026-04-09 13:17:02 +02:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jigaido#93