diff --git a/website/builder/test_site_assets.py b/website/builder/test_site_assets.py index 17a1e822..b1da9376 100644 --- a/website/builder/test_site_assets.py +++ b/website/builder/test_site_assets.py @@ -100,7 +100,8 @@ class SearchIndexTests(unittest.TestCase): (dist / 'notes' / '算法.md').write_text('见 [算法 - 目录](/notes/算法 - 目录.md)\n') (dist / '_sidebar.md').write_text('- [首页](/)\n\n- **示例分组**\n - [示例](/notes/%E7%A4%BA%E4%BE%8B.md)\n') (dist / 'stubs.json').write_text(json.dumps({'/notes/算法': '/notes/算法 - 目录'}, ensure_ascii=False)) - urls = json.loads(subprocess.run(['node', str(Path(__file__).parent / 'static_notes.cjs'), str(dist), 'https://example.com/', str(dist / 'stubs.json')], + (dist / 'sections.json').write_text(json.dumps({'示例': {'_1-爬楼梯': [['q1', '怎样爬楼梯?', 2]]}}, ensure_ascii=False)) + urls = json.loads(subprocess.run(['node', str(Path(__file__).parent / 'static_notes.cjs'), str(dist), 'https://example.com/', str(dist / 'stubs.json'), str(dist / 'sections.json')], check=True, capture_output=True, text=True).stdout) self.assertEqual(urls, ['https://example.com/notes/', 'https://example.com/notes/%E7%A4%BA%E4%BE%8B.html']) self.assertIn('示例', (dist / 'notes' / 'index.html').read_text()) @@ -114,6 +115,7 @@ class SearchIndexTests(unittest.TestCase): self.assertIn('', page) self.assertIn('href="/#/notes/%E7%A4%BA%E4%BE%8B"', page) self.assertNotIn('1. 爬楼梯\n