Google saved places: a name or description changed here survives a new export (the last imported text is kept per point, a field differing from it counts as a hand edit); the popup marks such a point as edited
CI / check (push) Successful in 8m50s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-27 12:47:58 +01:00
1 parent 3f4b30d737
commit 064871b687
4 files changed
+38 -5

No files matched your search

+8 -1
View File
@@ -54,9 +54,13 @@ class GoogleSavedTest < Minitest::Test
reine = points.call.find { |f| f["properties"]["name"] == "Reine" }
reine["properties"]["color"] = "#ff0000"
library.update_feature("points:x", reine["properties"]["id"], reine)
somewhere = points.call.find { |f| f["properties"]["name"] == "Somewhere" }
somewhere["properties"]["name"] = "Bratislava"
somewhere["properties"].delete("imported") # the popup needn't send it back
library.update_feature("points:x", somewhere["properties"]["id"], somewhere)
sleep 1.1 # a newer export (mtime) with a changed note, now found by name
write_zip.call("takeout-2.zip", CSV_TEXT.sub("red huts", "rorbuer"))
write_zip.call("takeout-2.zip", CSV_TEXT.sub("red huts", "rorbuer").sub("Somewhere,,", "Somewhere,a note,"))
Maptool::GoogleSaved.import_takeout(takeout, library: library, state_path: state, lookup: ->(*) { [13.0897, 67.9322] })
features = points.call
@@ -66,5 +70,8 @@ class GoogleSavedTest < Minitest::Test
assert_equal "#ff0000", reine["properties"]["color"], "own changes kept"
assert_equal [13.0897, 67.9322], reine["geometry"]["coordinates"], "approximate spot replaced by the exact one"
refute reine["properties"].key?("approximate")
renamed = features.find { |f| f["properties"]["source_id"].include?("48.1486") }
assert_equal "Bratislava", renamed["properties"]["name"], "a name changed here is kept"
assert_equal "a note", renamed["properties"]["description"].lines.first.strip, "an untouched description still updates"
end
end