🐛 停止改写共享前端模块
This commit is contained in:
1 parent
bf68e8dded
commit
5427c187d4
2 files changed
+12
-29
No files matched your search
@@ -1,8 +1,7 @@
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
from scripts.patch_admin_timeline_ui import build_lifecycle_script, patch_clipboard
|
||||
from scripts.patch_admin_timeline_ui import build_lifecycle_script, patch_clipboard, patch_file_manage
|
||||
|
||||
|
||||
class AdminTimelinePatchTests(unittest.TestCase):
|
||||
@@ -13,16 +12,10 @@ class AdminTimelinePatchTests(unittest.TestCase):
|
||||
self.assertIn("展开全部取件记录", script)
|
||||
self.assertIn("row.style.overflow = 'visible'", script)
|
||||
|
||||
def test_clipboard_rewrite_keeps_module_declaration_separator(self):
|
||||
source = '''const m=async(a,e={})=>{try{return!0}catch(r){return!1}},R=async(a,e={})=>{return a};export{m};'''
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
path = Path(temp_dir) / "clipboard-test.js"
|
||||
path.write_text(source, encoding="utf-8")
|
||||
|
||||
self.assertTrue(patch_clipboard(path))
|
||||
patched = path.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn("}},R=async", patched)
|
||||
def test_shared_compiled_modules_are_not_rewritten(self):
|
||||
placeholder = Path("unused.js")
|
||||
self.assertFalse(patch_file_manage(placeholder))
|
||||
self.assertFalse(patch_clipboard(placeholder))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user