Updated testing methodology to not create test scripts and just test in main code.
This commit is contained in:
@@ -30,7 +30,7 @@ See [preferences/communication.md](preferences/communication.md) for full detail
|
||||
|
||||
## Always Do
|
||||
|
||||
- **Tests first:** Always provide a way to immediately test/run the code you write
|
||||
- **No test files:** Don't create test files; I'll run the code directly to verify it works
|
||||
- **No credentials in code:** Secrets go in `.env` files; always provide a `.env.example`
|
||||
- **Consistent style:** Follow the conventions for the language in use — see preferences files
|
||||
- **Ask before big changes:** Clarify scope before rewriting or restructuring
|
||||
|
||||
@@ -101,18 +101,8 @@ Import-Module "$script:AppRoot\Modules\ProjectName.psm1" -Force
|
||||
|
||||
## Testing
|
||||
|
||||
- Use **Pester** for unit testing
|
||||
- Always provide a Pester test file alongside new functions
|
||||
- At minimum, test: happy path, expected failure cases, and edge cases
|
||||
- Run tests with: `Invoke-Pester -Path .\Tests\ -Output Detailed`
|
||||
|
||||
```powershell
|
||||
# Tests/Get-UserConfig.Tests.ps1
|
||||
Describe "Get-UserConfig" {
|
||||
It "Returns default config when file does not exist" { ... }
|
||||
It "Loads config from valid .psd1 file" { ... }
|
||||
}
|
||||
```
|
||||
- Do **not** create test files — I'll run the code directly to verify it works
|
||||
- If asked to write tests, use **Pester** with `Invoke-Pester -Path .\Tests\ -Output Detailed`
|
||||
|
||||
## Comments
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ ProjectName/
|
||||
├── README.md
|
||||
├── Modules/
|
||||
│ └── ProjectName.psm1 # Shared functions, config loading, helpers
|
||||
├── Tests/
|
||||
│ └── *.Tests.ps1 # Pester test files
|
||||
└── Release-Notes/
|
||||
├── v1.0.md
|
||||
└── v1.1.md
|
||||
@@ -53,15 +51,12 @@ project-name/
|
||||
├── routers/
|
||||
│ ├── auth.py
|
||||
│ └── [resource].py
|
||||
├── utils/
|
||||
└── tests/
|
||||
└── test_[resource].py
|
||||
└── utils/
|
||||
```
|
||||
|
||||
**Rules:**
|
||||
- `.env` is never committed — `.env.example` always is
|
||||
- Each resource (users, items, etc.) gets its own model, schema, and router file
|
||||
- Tests live inside `backend/app/tests/`
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -137,10 +137,8 @@ services:
|
||||
|
||||
## Testing
|
||||
|
||||
- Use **pytest** with **pytest-asyncio** for async tests
|
||||
- Always provide a test for each router endpoint at minimum (happy path + 1 failure case)
|
||||
- Use a separate test database — never run tests against the real DB
|
||||
- Run with: `pytest -v`
|
||||
- Do **not** create test files — I'll run the code directly to verify it works
|
||||
- If asked to write tests, use **pytest** with **pytest-asyncio**; use a separate test DB, never the real one
|
||||
|
||||
## Comments
|
||||
|
||||
|
||||
Reference in New Issue
Block a user