Problem/Motivation
The module currently has no automated tests. This is required for drupal.org project review and is essential for ensuring reliability as the module evolves.
Proposed resolution
Add the following test coverage:
Kernel Tests:
ContentIndexerTest – Tests the indexing service:
Indexing nodes from configured content types and fields
Skipping unpublished nodes
Automatic indexing on node create/update/delete
Removing unpublished nodes from index
Search/relevance scoring logic
getIndexedCount() returns correct count
Functional Tests:
SettingsFormTest – Tests the admin configuration form:
Form loads with correct fields
Saving provider, model, content sources
Re-index button triggers batch
Permission check (non-admin cannot access)
ChatApiTest – Tests the chat API endpoint:
POST /api/ai-content-chat/ask returns a response
Empty message returns 400 error
Permission check (anonymous cannot access without permission)
ChatbotBlockTest – Tests the block plugin:
Block renders the chat widget markup
Block passes correct drupalSettings
Remaining tasks
Write Kernel tests for ContentIndexer
Write Functional tests for SettingsForm, ChatApi, ChatbotBlock
Ensure tests pass in CI
Issue fork 3569915-3573400
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
solimanharkas commented