aprs.me/test/assets/js/map_issues_test.exs
2025-07-09 16:37:30 -05:00

55 lines
1.6 KiB
Elixir

defmodule AprsmeWeb.MapIssuesTest do
use ExUnit.Case, async: true
describe "map.ts issues" do
test "memory leaks identified" do
issues = [
"Interval timer on line 278 not stored or cleared - will run forever",
"Map event listeners (moveend, zoomend) not removed on destruction",
"No cleanup for map.whenReady callback"
]
assert length(issues) == 3
end
test "race conditions identified" do
issues = [
"programmaticMoveCounter can become incorrect with rapid moves",
"boundsTimer could have overlapping timeouts",
"Popup events could fire after component destruction"
]
assert length(issues) == 3
end
test "error handling issues" do
issues = [
"marker_clicked event doesn't check LiveView connection first",
"Errors in destroyed() are silently swallowed without logging",
"No user feedback for failed operations"
]
assert length(issues) == 3
end
test "performance issues" do
issues = [
"O(n) lookup for duplicate markers at same position",
"Unnecessary marker re-creation for popup opening",
"Repeated access to window.liveSocket without caching"
]
assert length(issues) == 3
end
test "code duplication" do
duplicated_functions = [
"Map state saving logic (lines 310-325 and 350-373)",
"Timestamp parsing (4 different locations)",
"Trail ID calculation (3 different locations)"
]
assert length(duplicated_functions) == 3
end
end
end