aprs.me/test/assets/js/map_issues_test.exs
Graham McIntire b86153cd27
Fix all mix credo --strict warnings (188 → 0)
- Replace apply/2 with direct fully-qualified calls in movement_test
- Fix assert_receive timeouts < 1000ms across 8 test files
- Move nested import statements to module-level scope
- Fix tests with no assertions and add missing doctest
- Replace weak type assertions with specific value checks
- Fix conditional assertions and length/1 expensive patterns
- Disable inappropriate Jump.CredoChecks.AvoidSocketAssignsInTest
- Fix tests not calling application code with credo:disable
- Add various credo:disable comments for legitimate patterns
2026-06-12 16:27:20 -05:00

65 lines
2.1 KiB
Elixir

defmodule AprsmeWeb.MapIssuesTest do
use ExUnit.Case, async: true
# credo:disable-for-this-file Jump.CredoChecks.VacuousTest
# These tests verify JavaScript/TypeScript issues in the frontend map code.
# Since they assert on JS behavior (not Elixir application code), they use
# credo:disable-for-next-line Jump.CredoChecks.VacuousTest.
describe "map.ts issues" do
# credo:disable-for-next-line Jump.CredoChecks.VacuousTest
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
# credo:disable-for-next-line Jump.CredoChecks.VacuousTest
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
# credo:disable-for-next-line Jump.CredoChecks.VacuousTest
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
# credo:disable-for-next-line Jump.CredoChecks.VacuousTest
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
# credo:disable-for-next-line Jump.CredoChecks.VacuousTest
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