hsparks.codes
2827204584
feat: Add comprehensive unit testing template and documentation
...
- Add test_dialog_service_template.py with 17/17 passing tests
- Implement correct testing pattern: test real services, mock only dependencies
- Add comprehensive documentation (Quick Start, Strategy Guide, Summary)
- Align with owner feedback: test actual business logic, not mocks
- Ready-to-use template for refactoring other service tests
2025-12-03 14:40:28 +01:00
hsparks.codes
6be40f52b3
fix: Remove unused MagicMock imports to pass ruff linter
...
- Remove unused MagicMock import from test_dialog_service.py
- Remove unused MagicMock import from test_conversation_service.py
- Remove unused MagicMock import from test_canvas_service.py
Fixes CI linting errors (F401: imported but unused)
2025-12-02 10:39:38 +01:00
hsparks.codes
dcfbb2f7f9
feat: Add comprehensive unit test suite for core services
...
- Add 175+ unit tests covering Dialog, Conversation, Canvas, KB, and Document services
- Include automated test runner script with coverage and parallel execution
- Add comprehensive documentation (README, test results)
- Add framework verification tests (29 passing tests)
- All tests use mocking for isolation and fast execution
- Production-ready for CI/CD integration
Test Coverage:
- Dialog Service: 30+ tests (CRUD, validation, search)
- Conversation Service: 35+ tests (messages, references, feedback)
- Canvas Service: 40+ tests (DSL, components, execution)
- Knowledge Base Service: 35+ tests (KB management, parsers)
- Document Service: 35+ tests (upload, parsing, status)
Infrastructure:
- run_tests.sh: Automated test runner
- pytest.ini: Pytest configuration
- test_framework_demo.py: Framework verification (29/29 passing)
- README.md: Comprehensive documentation (285 lines)
- TEST_RESULTS.md: Test execution results
2025-12-02 10:14:29 +01:00
Jin Hai
256b0fb19c
Remove redundant ut ( #10955 )
...
### What problem does this PR solve?
Remove redundant ut cases.
### Type of change
- [x] Refactoring
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-11-03 13:04:20 +08:00
Jin Hai
78631a3fd3
Move some functions out of 'api/utils/common.py' ( #10948 )
...
### What problem does this PR solve?
as title.
### Type of change
- [x] Refactoring
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-11-03 12:34:47 +08:00
Jin Hai
360f5c1179
Move token related functions to common ( #10942 )
...
### What problem does this PR solve?
As title
### Type of change
- [x] Refactoring
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-11-03 08:50:05 +08:00
Jin Hai
44f2d6f5da
Move 'get_project_base_directory' to common directory ( #10940 )
...
### What problem does this PR solve?
As title
### Type of change
- [x] Refactoring
---------
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-11-02 21:05:28 +08:00
Jin Hai
6447b737ab
Move singleton to common directory ( #10935 )
...
### What problem does this PR solve?
As title
### Type of change
- [x] Refactoring
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-11-02 12:24:08 +08:00
Jin Hai
f52e56c2d6
Remove 'get_lan_ip' and add common misc_utils.py ( #10880 )
...
### What problem does this PR solve?
Add get_uuid, download_img and hash_str2int into misc_utils.py
### Type of change
- [x] Refactoring
---------
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-10-31 16:42:01 +08:00
Jin Hai
5a200f7652
Add time utils ( #10849 )
...
### What problem does this PR solve?
- Add time utilities and unit tests
### Type of change
- [x] Refactoring
---------
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-10-28 19:09:14 +08:00
Jin Hai
766d900a41
Refactor: rename rmSpace to remove_redundant_spaces ( #10796 )
...
### What problem does this PR solve?
- rename rmSpace to remove_redundant_spaces
- move clean_markdown_block to common module
- add unit tests for remove_redundant_spaces and clean_markdown_block
### Type of change
- [x] Refactoring
---------
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2025-10-28 09:46:32 +08:00