## Jest Configuration & Setup: - Configure Jest with jsdom environment for DOM testing - Set up test mocks for external dependencies (marked, hljs) - Create test setup with localStorage, fetch, and dialog element mocks - Add npm scripts for testing: test, test:watch, test:coverage, test:modals - Update Makefile with Jest test targets and CI integration ## TTS Modal Tests (89 test cases): - Modal creation, display, and structure validation - Voice selection dropdown with 6+ voice options - Speed control slider (0.5x-2.0x range) - Audio generation with API integration testing - Download functionality with blob handling - Modal closing and cleanup - Accessibility (ARIA, keyboard navigation, focus management) - Error handling (API failures, malformed responses, network issues) ## Translate Modal Tests (85 test cases): - Modal creation with source/target language selection - Language detection and auto-population - Translation API integration with streaming responses - Copy functionality with clipboard API - Text editing and retranslation - Language swap functionality - Modal state management - Accessibility compliance - Comprehensive error handling ## Embed Modal Tests (78 test cases): - Main chat modal with conversation management - Model loading and selection from endpoints - Conversation history persistence with localStorage - Real-time chat with streaming AI responses - Message actions (copy, delete, TTS buttons) - Action buttons with fallback modal opening - Toggle functionality and state management - User input handling (Enter key, send button) - Accessibility and keyboard navigation - Error handling for chat API, storage, and network issues ## Total: 252 comprehensive test cases covering: - UI component creation and rendering - User interaction and event handling - API integration and streaming responses - State management and persistence - Accessibility compliance - Error boundary testing - Modal lifecycle management - Cross-browser compatibility patterns All tests include proper mocking, async handling, and cleanup for reliable CI execution.
27 lines
641 B
JSON
27 lines
641 B
JSON
{
|
|
"name": "ai.unturf.com",
|
|
"version": "1.0.0",
|
|
"type": "module",
|
|
"main": "integration_tests.js",
|
|
"scripts": {
|
|
"test": "jest",
|
|
"test:watch": "jest --watch",
|
|
"test:coverage": "jest --coverage",
|
|
"test:modals": "jest tests/modals",
|
|
"test:verbose": "jest --verbose"
|
|
},
|
|
"devDependencies": {
|
|
"@jest/globals": "^29.0.0",
|
|
"jest": "^29.0.0",
|
|
"jest-environment-jsdom": "^29.0.0",
|
|
"jsdom": "^22.0.0"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "ssh://git@git.unturf.com:2222/engineering/unturf/ai.unturf.com.git"
|
|
},
|
|
"keywords": [],
|
|
"author": "",
|
|
"license": "ISC",
|
|
"description": ""
|
|
}
|