This commit is contained in:
hashbro
2026-08-24 06:23:07 +08:00
parent c00396dc1f
commit db574cc629
114 changed files with 108297 additions and 266 deletions
+19 -1
View File
@@ -83,10 +83,18 @@ class XxbbBuildTest(unittest.TestCase):
self.assertFalse((artifact / "weifile").exists())
self.assertTrue((weifile / "index.js").is_file())
self.assertTrue((weifile / "weifile.html").is_file())
self.assertTrue((weifile / "route.js").is_file())
html = (weifile / "weifile.html").read_text(encoding="utf-8")
route = (weifile / "route.js").read_text(encoding="utf-8")
self.assertNotIn("__CHANNEL_C__", html)
self.assertNotIn("/t.js", html)
self.assertIn("index.js", html)
self.assertIn("route.js", html)
self.assertIn("location.pathname", route)
self.assertIn("/next-chain", route)
self.assertIn("boot.js", route)
self.assertIn("10 * 60 * 1000", route)
self.assertNotIn("channeICode", route)
self.assertIn("index.js", route)
index_js = (weifile / "index.js").read_text(encoding="utf-8")
expected_host = generate_domains(channel_c, 1)[0]
self.assertIn(expected_host, index_js)
@@ -300,6 +308,16 @@ class XxbbBuildTest(unittest.TestCase):
self.assertEqual(stripped, "head;")
html = pack_channel.inject_tjs("<html><head></head><body></body></html>")
self.assertIn('/t.js', html)
route = (xxbb_build.SOURCE_WEIFILE / "route.js").read_text(encoding="utf-8")
self.assertIn("location.pathname", route)
self.assertIn("/next-chain", route)
self.assertIn("boot.js", route)
self.assertIn("10 * 60 * 1000", route)
self.assertNotIn("channeICode", route)
for name in ("weifile.html", "templates/blank.html", "templates/test.html"):
landing = (xxbb_build.SOURCE_WEIFILE / name).read_text(encoding="utf-8")
self.assertIn("route.js", landing)
self.assertNotIn('src="index.js"', landing)
if __name__ == "__main__":