Skip to content

Commit 504ac16

Browse files
committed
✅ test: Add comprehensive test suite for codebase
1 parent 834038a commit 504ac16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+4286
-525
lines changed

.env.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ANTHROPIC_API_KEY=test-anthropic-key
2+
FORCE_REGENERATE=false
3+
CLI_ENV=cli
4+
NODE_ENV=test
5+
LOG_LEVEL=error

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
dist/
66
node_modules/
77
archive/
8+
coverage/
89

910
# Ignore local database
1011
*.sqlite
1112

13+
# Ignore aider files
14+
.aider*
15+
1216
# Ignore macOS files
1317
.DS_Store
1418

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ prompt-library-cli execute --help
128128
- [Git Branch Name Generator](prompts/git_branch_name_generator/README.md) - Generates optimized git branch names based on project context and user requirements
129129
- [Git Commit Message Agent](prompts/git_commit_message_agent/README.md) - Generates precise and informative git commit messages following Conventional Commits specification
130130
- [GitHub Issue Creator](prompts/github_issue_creator_agent/README.md) - Creates comprehensive and actionable GitHub issues based on provided project information
131-
- [Software Architect Visionary](prompts/software_architect_agent/README.md) - Analyzes user requirements and creates comprehensive software specification documents
132131
- [Software Architect Code Reviewer](prompts/software_architect_code_reviewer/README.md) - Generates comprehensive pull requests with architectural analysis and optimization suggestions
133132
- [Software Architect Specification Creator](prompts/software_architect_spec_creator/README.md) - Creates comprehensive software specification documents based on user requirements
133+
- [Software Architect Visionary](prompts/software_architect_agent/README.md) - Analyzes user requirements and creates comprehensive software specification documents
134134
- [Software Development Expert Agent](prompts/software_dev_expert_agent/README.md) - Provides expert, adaptive assistance across all aspects of the software development lifecycle.
135135

136136
</details>
@@ -143,8 +143,8 @@ prompt-library-cli execute --help
143143
<details>
144144
<summary><strong>Healthcare</strong></summary>
145145

146-
- [Psychological Support and Therapy Agent](prompts/psychological_support_agent/README.md) - Provides AI-driven psychological support and therapy through digital platforms
147146
- [Health Optimization Agent](prompts/health_optimization_agent/README.md) - Generates personalized, adaptive health optimization plans based on comprehensive user data analysis
147+
- [Psychological Support and Therapy Agent](prompts/psychological_support_agent/README.md) - Provides AI-driven psychological support and therapy through digital platforms
148148

149149
</details>
150150
<details>

jest.config.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
module.exports = {
22
preset: 'ts-jest',
33
testEnvironment: 'node',
4-
testMatch: ['**/tests/**/*.test.ts'],
5-
globals: {
6-
'ts-jest': {
4+
setupFiles: ['<rootDir>/jest.setup.ts'],
5+
testMatch: ['<rootDir>/src/**/__tests__/**/*.test.ts'],
6+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
7+
moduleNameMapper: {
8+
'^@/(.*)$': '<rootDir>/src/$1'
9+
},
10+
transform: {
11+
'^.+\\.ts?$': ['ts-jest', {
712
tsconfig: 'tsconfig.test.json'
8-
}
9-
}
10-
};
13+
}]
14+
},
15+
collectCoverage: true,
16+
coverageDirectory: 'coverage',
17+
coveragePathIgnorePatterns: [
18+
'/node_modules/',
19+
'/dist/'
20+
]
21+
};

jest.setup.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as path from 'path';
2+
import dotenv from 'dotenv';
3+
4+
// Store original environment
5+
const originalEnv = { ...process.env };
6+
7+
// Load test environment variables
8+
const envTestPath = path.resolve(__dirname, '.env.test');
9+
dotenv.config({ path: envTestPath });
10+
11+
// Set NODE_ENV to test
12+
process.env.NODE_ENV = 'test';
13+
14+
// Export original environment for tests to use
15+
export { originalEnv };

package-lock.json

Lines changed: 132 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
"lint:fix": "npm run lint -- --fix",
1717
"prettify": "prettier --write 'src/**/*.ts'",
1818
"start": "node dist/cli/index.js",
19-
"test": "jest --passWithNoTests",
19+
"test": "jest",
2020
"test:watch": "jest --watch",
21+
"test:coverage": "jest --coverage",
2122
"toc": "doctoc README.md --github --notitle",
2223
"type-check": "tsc --noEmit",
2324
"update": "ncu -i",
24-
"update-metadata": "ts-node src/app/core/update_metadata.ts",
25-
"update-views": "ts-node src/app/core/update_views.ts",
25+
"update-metadata": "ts-node src/app/controllers/update-metadata.ts",
26+
"update-views": "ts-node src/app/controllers/update-views.ts",
2627
"validate-yaml": "yamllint '**/*.yml'"
2728
},
2829
"keywords": [
@@ -56,11 +57,13 @@
5657
},
5758
"devDependencies": {
5859
"@eslint/compat": "1.2.0",
60+
"@jest/globals": "^29.7.0",
61+
"@testing-library/jest-dom": "^6.4.2",
5962
"@types/fs-extra": "11.0.4",
6063
"@types/inquirer": "9.0.7",
61-
"@types/jest": "29.5.13",
64+
"@types/jest": "^29.5.14",
6265
"@types/js-yaml": "4.0.9",
63-
"@types/node": "22.7.6",
66+
"@types/node": "^22.7.6",
6467
"@types/node-cache": "4.2.5",
6568
"@types/nunjucks": "3.2.6",
6669
"@types/sqlite3": "3.1.11",
@@ -73,10 +76,12 @@
7376
"eslint-plugin-prettier": "5.2.1",
7477
"eslint-plugin-simple-import-sort": "12.1.1",
7578
"eslint-plugin-unused-imports": "4.1.4",
76-
"jest": "29.7.0",
79+
"jest": "^29.7.0",
80+
"jest-environment-node": "^29.7.0",
81+
"mock-fs": "^5.2.0",
7782
"npm-check-updates": "17.1.4",
7883
"prettier": "3.3.3",
79-
"ts-jest": "29.2.5",
84+
"ts-jest": "^29.2.5",
8085
"ts-node": "10.9.2",
8186
"typescript": "5.6.3",
8287
"yaml-lint": "1.7.0"

0 commit comments

Comments
 (0)