summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/project/documents/cached/source_map_trailing_whitespace.js2
-rw-r--r--tests/staticfiles_tests/test_storage.py14
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/project/documents/cached/source_map_trailing_whitespace.js b/tests/staticfiles_tests/project/documents/cached/source_map_trailing_whitespace.js
new file mode 100644
index 0000000000..e15bc402a9
--- /dev/null
+++ b/tests/staticfiles_tests/project/documents/cached/source_map_trailing_whitespace.js
@@ -0,0 +1,2 @@
+//# sourceMappingURL=source_map.js.map
+let a_variable = 1;
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")