Commit ac701b5
authored
feat(dictionary): expose DictionaryService API in preload and add comprehensive tests (#143)
- Add dictionary API to preload layer for frontend access
- Create comprehensive test suite for DictionaryService with 18 test cases
- Test coverage includes success scenarios, error handling, HTML parsing robustness, parameter processing, and edge cases
- Verify API can handle various dictionary response formats and gracefully handle network errors
- All tests pass, demonstrating production-ready robustness
API Usage:
```typescript
const result = await window.api.dictionary.queryEudic('hello', 'greeting context');
if (result.success) {
console.log(result.data); // { word, phonetic, definitions, examples, translations }
}
```1 parent e26ef4f commit ac701b5
2 files changed
Lines changed: 492 additions & 1 deletion
0 commit comments