From e1066ce5fe66de799a2bc27d2a16d4a059535d62 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Fri, 6 Nov 2026 07:10:29 +0800 Subject: [PATCH] Update test_site_assets.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充全部笔记目录页的测试。 --- website/builder/test_site_assets.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/builder/test_site_assets.py b/website/builder/test_site_assets.py index 33fef84e..17a1e822 100644 --- a/website/builder/test_site_assets.py +++ b/website/builder/test_site_assets.py @@ -98,10 +98,12 @@ class SearchIndexTests(unittest.TestCase): ''.join(f'## {t}\n\n内容\n\n' for t in titles[1:]) + 'HTML 链接\n\n```java\n# 不是标题\n```\n' (dist / 'notes' / '示例.md').write_text(body) (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')], check=True, capture_output=True, text=True).stdout) - self.assertEqual(urls, ['https://example.com/notes/%E7%A4%BA%E4%BE%8B.html']) + 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()) page = (dist / 'notes' / '示例.html').read_text() counts = collections.Counter() expected = [heading_slug(t, counts) for t in titles]