Skip to content

Commit

Permalink
✅ test: Add comprehensive test suite for codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultyou committed Oct 23, 2024
1 parent 834038a commit 7392861
Show file tree
Hide file tree
Showing 70 changed files with 4,152 additions and 522 deletions.
5 changes: 5 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ANTHROPIC_API_KEY=test-anthropic-key
FORCE_REGENERATE=false
CLI_ENV=cli
NODE_ENV=test
LOG_LEVEL=error
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
dist/
node_modules/
archive/
coverage/

# Ignore local database
*.sqlite

# Ignore aider files
.aider*

# Ignore macOS files
.DS_Store

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

</details>
Expand All @@ -143,8 +143,8 @@ prompt-library-cli execute --help
<details>
<summary><strong>Healthcare</strong></summary>

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

</details>
<details>
Expand Down
23 changes: 17 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/tests/**/*.test.ts'],
globals: {
'ts-jest': {
setupFiles: ['<rootDir>/jest.setup.ts'],
testMatch: ['<rootDir>/src/**/__tests__/**/*.test.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
transform: {
'^.+\\.ts?$': ['ts-jest', {
tsconfig: 'tsconfig.test.json'
}
}
};
}]
},
collectCoverage: true,
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [
'/node_modules/',
'/dist/'
]
};
15 changes: 15 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as path from 'path';
import dotenv from 'dotenv';

// Store original environment
const originalEnv = { ...process.env };

// Load test environment variables
const envTestPath = path.resolve(__dirname, '.env.test');
dotenv.config({ path: envTestPath });

// Set NODE_ENV to test
process.env.NODE_ENV = 'test';

// Export original environment for tests to use
export { originalEnv };
140 changes: 132 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
"lint:fix": "npm run lint -- --fix",
"prettify": "prettier --write 'src/**/*.ts'",
"start": "node dist/cli/index.js",
"test": "jest --passWithNoTests",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"toc": "doctoc README.md --github --notitle",
"type-check": "tsc --noEmit",
"update": "ncu -i",
"update-metadata": "ts-node src/app/core/update_metadata.ts",
"update-views": "ts-node src/app/core/update_views.ts",
"update-metadata": "ts-node src/app/controllers/update-metadata.ts",
"update-views": "ts-node src/app/controllers/update-views.ts",
"validate-yaml": "yamllint '**/*.yml'"
},
"keywords": [
Expand Down Expand Up @@ -56,11 +57,13 @@
},
"devDependencies": {
"@eslint/compat": "1.2.0",
"@jest/globals": "^29.7.0",
"@testing-library/jest-dom": "^6.4.2",
"@types/fs-extra": "11.0.4",
"@types/inquirer": "9.0.7",
"@types/jest": "29.5.13",
"@types/jest": "^29.5.14",
"@types/js-yaml": "4.0.9",
"@types/node": "22.7.6",
"@types/node": "^22.7.6",
"@types/node-cache": "4.2.5",
"@types/nunjucks": "3.2.6",
"@types/sqlite3": "3.1.11",
Expand All @@ -73,10 +76,12 @@
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-unused-imports": "4.1.4",
"jest": "29.7.0",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"mock-fs": "^5.2.0",
"npm-check-updates": "17.1.4",
"prettier": "3.3.3",
"ts-jest": "29.2.5",
"ts-jest": "^29.2.5",
"ts-node": "10.9.2",
"typescript": "5.6.3",
"yaml-lint": "1.7.0"
Expand Down
Loading

0 comments on commit 7392861

Please sign in to comment.