Chore: Got code coverage up to 98%
This commit is contained in:
@@ -40,4 +40,70 @@ Feature: Project Service
|
||||
Then I should receive statistics
|
||||
And the statistics should include "plans"
|
||||
And the statistics should include "context_files"
|
||||
And the statistics should include "changes"
|
||||
And the statistics should include "changes"
|
||||
|
||||
Scenario: Initialization fails gracefully when filesystem operations error
|
||||
Given I have a project service
|
||||
And I prepare a project path "fs-error-project"
|
||||
When I initialize the project with filesystem failure
|
||||
Then a FileSystemError should be raised with message "Failed to create project structure"
|
||||
|
||||
Scenario: Duplicate project name uses database validation when directory missing
|
||||
Given I have a project service
|
||||
And I prepare a project path "duplicate-db"
|
||||
And I have initialized that project once already
|
||||
And the cleveragents directory has been removed for that project
|
||||
When I initialize the same project without force using database state
|
||||
Then I should get a ValidationError
|
||||
And the error message should contain "already exists"
|
||||
|
||||
Scenario: Migration returns existing project without creating duplicates
|
||||
Given I have a project service
|
||||
And I prepare a project path "migration-existing"
|
||||
And I have initialized that project once already
|
||||
And the cleveragents directory has been removed for that project
|
||||
And the legacy migration will report success without changes
|
||||
When I initialize the same project without force during migration
|
||||
Then the existing project should be reused
|
||||
|
||||
Scenario: Fallback current project is synthesized when database lacks record
|
||||
Given I have a project service
|
||||
And I set up a standalone project directory named "standalone-fallback" with a name file
|
||||
When I fetch the current project from that directory without database entry
|
||||
Then a temporary project named "standalone-fallback" should be returned
|
||||
|
||||
Scenario: Legacy project without name file uses directory name
|
||||
Given I have a project service
|
||||
And I set up a standalone project directory named "legacy-no-name" without a name file
|
||||
When I fetch the current project from that directory without database entry
|
||||
Then a temporary project named "legacy-no-name" should be returned
|
||||
|
||||
Scenario: No project directory results in no current project
|
||||
Given I have a project service
|
||||
And I prepare an empty working directory
|
||||
When I fetch the current project from that directory without database entry
|
||||
Then no current project should be found
|
||||
|
||||
Scenario: Retrieve project by name returns saved project
|
||||
Given I have a project service
|
||||
And I have initialized a service project "lookup-project" at "/tmp/test"
|
||||
When I try to get a project by name "lookup-project"
|
||||
Then the project lookup result should be found
|
||||
|
||||
Scenario: Create project alias delegates to initializer
|
||||
Given I have a project service
|
||||
And I prepare a project path "alias-project"
|
||||
When I create the project using the alias method
|
||||
Then the alias project should be created successfully
|
||||
|
||||
Scenario: Retrieve project by path finds the matching record
|
||||
Given I have a project service
|
||||
And I have initialized a service project "path-project" at "/tmp/test"
|
||||
When I look up the project by its saved path
|
||||
Then the project lookup result should be found
|
||||
|
||||
Scenario: Default ordering falls back to created_at
|
||||
Given I have a project service
|
||||
And I have multiple projects created at different times
|
||||
When I list all projects with unknown ordering
|
||||
Then the projects should be returned in creation order
|
||||
|
||||
Reference in New Issue
Block a user