Comprehensive testing for Invoice SaaS system functionality
Test OpenAI integration and invoice parsing accuracy
Tests AI parsing of simple English invoice requests
Expected: Should extract recipient, items, and amounts from English text
Tests AI parsing of Cantonese invoice requests
Expected: Should extract recipient, items, and amounts from Cantonese text
Tests AI parsing of mixed English/Chinese text
Expected: Should handle mixed language content and extract data correctly
Tests AI parsing of complex invoices with multiple items and calculations
Expected: Should extract multiple items, quantities, rates, and terms
Tests AI parsing that normalizes different currency mentions to company default
Expected: Should normalize mixed currency mentions to company default currency
Tests AI parsing with invalid inputs and edge cases
Expected: Should handle errors gracefully and provide meaningful feedback
Compare AI vs Manual invoice creation
Compares AI-generated invoice with manually created equivalent
Expected: AI and manual invoices should have matching data and amounts
Compares AI parsing of complex multi-item invoices with manual creation
Expected: Should accurately parse hourly rates, quantities, and totals
Tests mathematical accuracy of invoice amount calculations
Expected: Should correctly calculate subtotals, taxes, and final amounts
Tests that invoices maintain consistent currency per company settings
Expected: Should use company default currency and handle foreign currency mentions appropriately
Tests tax calculation and application in invoices
Expected: Should parse tax percentages and calculate tax amounts correctly
Tests automatic invoice number generation and formatting
Expected: Should generate unique, sequential invoice numbers in correct format
Test PDF templates grouped by language and company defaults
Tests that company default template is properly used
Expected: Should use company default template setting for all automated generation
Tests that AI-generated invoices always use company default template
Expected: AI-generated invoices should automatically use company default template
Tests PDF generation with English Classic template
Expected: Should generate professional English PDF with classic styling
Tests PDF generation with English Modern template
Expected: Should generate clean modern English PDF
Tests PDF generation with Traditional Chinese Hong Kong classic template
Expected: Should generate properly formatted Traditional Chinese PDF with HK styling
Tests PDF generation with Traditional Chinese Hong Kong modern template
Expected: Should generate clean modern Traditional Chinese PDF
Tests that manual input real-time preview matches generated PDF 100%
Expected: Real-time HTML preview should be identical to final PDF output
Tests that templates are properly grouped and selected by language
Expected: Should show appropriate template options based on company locale/language settings
Test all REST API endpoints
Tests Create, Read, Update, Delete operations for companies
Expected: Should successfully create, read, update, and delete company records
Tests Create, Read, Update, Delete operations for invoices
Expected: Should successfully manage invoice lifecycle operations
Tests AI-powered invoice generation endpoint
Expected: Should generate invoices from text input via API
Tests PDF generation API endpoint functionality
Expected: Should generate PDF files from invoice data via API
Tests API authentication and authorization mechanisms
Expected: Should properly handle authentication bypass for test endpoints
Tests API input validation and error responses
Expected: Should reject invalid inputs and return appropriate error messages
Tests API error handling for various failure scenarios
Expected: Should handle errors gracefully with proper HTTP status codes
Test database connectivity and operations
Tests MongoDB connection and basic database operations
Expected: Should connect to MongoDB and perform basic queries successfully
Tests company model CRUD operations and validations
Expected: Should create, read, update, delete companies with proper validation
Tests invoice model operations and relationships
Expected: Should manage invoice data with proper company relationships
Tests recipient data management and storage
Expected: Should store and retrieve recipient information correctly
Tests database transaction integrity and rollback scenarios
Expected: Should maintain data consistency during complex operations
Tests database schema consistency and model validations
Expected: Should enforce schema rules and validate data integrity
Test language switching and localization
Tests language switching functionality between English and Chinese
Expected: Should switch languages and display correct translations
Tests completeness of translations for all supported languages
Expected: Should have complete translations for all UI elements
Tests currency formatting for different locales and currencies
Expected: Should format currencies correctly according to locale settings
Tests date formatting for different locales and formats
Expected: Should format dates according to locale-specific conventions
Tests detection and prevention of mixed language content
Expected: Should detect and handle mixed language content appropriately