Commit graph

3 commits

Author SHA1 Message Date
Wuesteon
74654e652a 🐛 fix(cors): compile shared-nestjs-cors to JavaScript for production
The shared-nestjs-cors package was exporting raw TypeScript files, which caused
runtime errors in production Docker containers:
  SyntaxError: Unexpected token 'export'

Changes:
- Add build script to compile TypeScript to JavaScript
- Update package.json to export compiled dist files instead of src
- Add build step to all backend Dockerfiles that use this package
- Package now builds to CommonJS in dist/ folder

Fixes staging deployment failures for mana-core-auth and other backends.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-17 18:42:47 +01:00
Wuesteon
c5d662bb89 test(cors): add comprehensive unit tests for shared-nestjs-cors
Add 63 unit tests with 100% code coverage for CORS configuration utilities.

**Test Coverage:**
- createCorsConfig() function (24 tests)
  - Default behavior and configuration structure
  - Environment variable parsing (comma-separated, trimming)
  - includeAllManaApps flag functionality
  - Custom development origins
  - Additional origins (mobile apps)
  - Origin deduplication across all sources
  - Combined options integration

- createCorsConfigWithCallback() function (15 tests)
  - Callback mode for mobile app support
  - No origin handling (server-to-server)
  - Valid/invalid origin validation
  - Security: protocol-sensitive matching
  - Callback return value validation

- Origin constants (24 tests)
  - MANACORE_STAGING_ORIGINS validation
  - MANACORE_PRODUCTION_ORIGINS validation
  - MANACORE_ALL_APP_ORIGINS combination
  - URL format validation
  - Duplicate detection
  - Consistency between environments

**Results:**
- 63 tests passing
- 100% code coverage (statements, branches, functions, lines)
- All edge cases covered (empty values, whitespace, duplicates)

**Setup:**
- Added Jest with ts-jest for TypeScript support
- Added test scripts: test, test:watch, test:coverage
- Created jest.config.js with coverage configuration
- Proper TypeScript types for callback functions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-17 18:11:13 +01:00
Wuesteon
4c44764838 1. Brevo email integration (API key, sender settings)
2. URL configuration fix (BASE_URL, FRONTEND_URL)
  3. Password reset URL pointing to frontend instead of API
2025-12-17 18:11:13 +01:00