test-enhance.mjs 646 B

12345678910111213141516171819202122
  1. import { enhanceFormsOfWords } from './src/api/yjbdc/aiController.js';
  2. // 创建一个测试用例
  3. const testJson = {
  4. ArticleEnglish: [
  5. "The quick brown fox jumps over the lazy dog.",
  6. "She is running in the park every morning.",
  7. "They have been working on this project for months.",
  8. "I went to the store yesterday and bought some groceries.",
  9. "The children are playing with their new toys."
  10. ],
  11. FormsOfWords: []
  12. };
  13. // 测试单词列表
  14. const testWords = "fox, run, go, play, work";
  15. // 调用函数
  16. const result = enhanceFormsOfWords(testJson, testWords);
  17. // 打印结果
  18. console.log(JSON.stringify(result, null, 2));