From 00639dbd6d023aaba20efa5497988cd730923633 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 3 Jun 2022 12:04:59 +0100 Subject: Refs #33765 -- Added tests for trailing whitespace in JavaScript source map references. --- tests/staticfiles_tests/test_storage.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/staticfiles_tests/test_storage.py') diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py index 3783d32872..745094acf6 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -280,6 +280,20 @@ class TestHashedFiles: ) self.assertPostCondition() + def test_js_source_map_trailing_whitespace(self): + relpath = self.hashed_file_path("cached/source_map_trailing_whitespace.js") + self.assertEqual( + relpath, "cached/source_map_trailing_whitespace.cd45b8534a87.js" + ) + with storage.staticfiles_storage.open(relpath) as relfile: + content = relfile.read() + self.assertNotIn(b"//# sourceMappingURL=source_map.js.map\t ", content) + self.assertIn( + b"//# sourceMappingURL=source_map.js.99914b932bd3.map", + content, + ) + self.assertPostCondition() + def test_js_source_map_sensitive(self): relpath = self.hashed_file_path("cached/source_map_sensitive.js") self.assertEqual(relpath, "cached/source_map_sensitive.5da96fdd3cb3.js") -- cgit v1.3