Skip to content

Commit 3d91d92

Browse files
authored
Merge pull request #61 from frankbria/feature/prd-import-tests
test(import): add 22 comprehensive tests for ralph_import.sh
2 parents 27df197 + b06d979 commit 3d91d92

3 files changed

Lines changed: 732 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
This is the Ralph for Claude Code repository - an autonomous AI development loop system that enables continuous development cycles with intelligent exit detection and rate limiting.
88

9-
**Version**: v0.9.4 | **Tests**: 201 passing (100% pass rate) | **CI/CD**: GitHub Actions
9+
**Version**: v0.9.5 | **Tests**: 223 passing (100% pass rate) | **CI/CD**: GitHub Actions
1010

1111
## Core Architecture
1212

@@ -272,7 +272,7 @@ Ralph uses advanced error detection with two-stage filtering to eliminate false
272272

273273
## Test Suite
274274

275-
### Test Files (201 tests total)
275+
### Test Files (223 tests total)
276276

277277
| File | Tests | Description |
278278
|------|-------|-------------|
@@ -285,6 +285,7 @@ Ralph uses advanced error detection with two-stage filtering to eliminate false
285285
| `test_edge_cases.bats` | 20 | Edge case handling |
286286
| `test_installation.bats` | 14 | Global installation/uninstall workflows |
287287
| `test_project_setup.bats` | 36 | Project setup (setup.sh) validation |
288+
| `test_prd_import.bats` | 22 | PRD import (ralph_import.sh) workflows |
288289

289290
### Running Tests
290291
```bash
@@ -300,6 +301,19 @@ bats tests/unit/test_cli_parsing.bats
300301

301302
## Recent Improvements
302303

304+
### PRD Import Tests (v0.9.5)
305+
- Added 22 comprehensive tests for `ralph_import.sh` PRD conversion script
306+
- Tests cover: file format support (.md, .txt, .json), output file creation, project naming
307+
- Mock infrastructure for `ralph-setup` and Claude Code CLI isolation
308+
- Output file validation: PROMPT.md, @fix_plan.md, specs/requirements.md creation
309+
- Project naming tests: custom names, auto-detection from filename, path handling
310+
- Error handling tests: missing source file, missing ralph-setup, conversion failures
311+
- Help and usage tests: --help flag, no arguments behavior
312+
- Full workflow integration: complete project structure validation
313+
- Edge cases: hyphens in names, uppercase filenames, subdirectory paths
314+
- Test helper: added `create_sample_prd_txt()` fixture function
315+
- Test count: 223 (up from 201)
316+
303317
### Project Setup Tests (v0.9.4)
304318
- Added 36 comprehensive tests for `setup.sh` project initialization script
305319
- Tests cover: directory creation, subdirectory structure, template copying, git initialization

tests/helpers/fixtures.bash

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,32 @@ Target MVP completion in 4-6 weeks of development.
6363
EOF
6464
}
6565

66+
# Sample PRD Document (Text)
67+
create_sample_prd_txt() {
68+
local file=${1:-"sample_prd.txt"}
69+
cat > "$file" << 'EOF'
70+
Project: Task Management System
71+
72+
Requirements:
73+
- User authentication with email/password
74+
- Task CRUD operations (create, read, update, delete)
75+
- Team collaboration features
76+
- Real-time updates for shared workspaces
77+
78+
Tech Stack:
79+
- Frontend: React, TypeScript
80+
- Backend: Node.js, Express
81+
- Database: PostgreSQL
82+
83+
Timeline: 4-6 weeks for MVP
84+
85+
Success Criteria:
86+
- Users can create and manage tasks
87+
- Teams can collaborate on shared projects
88+
- Performance: <2s page load time
89+
EOF
90+
}
91+
6692
# Sample PRD Document (JSON)
6793
create_sample_prd_json() {
6894
local file=${1:-"sample_prd.json"}

0 commit comments

Comments
 (0)