Test non-Latin script fallback in handle generation

Documents and pins the behaviour for scripts without transliteration
entries (Japanese, Chinese, Arabic, …):

- Fully non-Latin name (e.g. "日本語プロジェクト"): every initial
  maps to "?" via I18n.transliterate, filter_map drops them all,
  empty acronym falls back to FALLBACK_HANDLE ("PROJ").

- Mixed name (e.g. "Plan 日本"): Latin initials survive, non-Latin
  ones are silently dropped, result is the Latin-only acronym ("P").
This commit is contained in:
Kabiru Mwenja
2026-02-26 12:09:38 +03:00
parent 20b7a280f6
commit def97b72fd
@@ -93,7 +93,11 @@ RSpec.describe WorkPackages::ProjectHandleSuggestionGenerator do
"Flight Planning Training" => "FPT",
"A B C D E F G H I J K" => "ABCDEFGHIJ", # truncated to 10 chars
"Cécile Martin" => "CM", # Unicode: "Cécile" is one word, not ["C","cile"]
"étude de cas" => "EDC" # Unicode: é→E via transliteration
"étude de cas" => "EDC", # Unicode: é→E via transliteration
# Non-Latin scripts have no transliteration entries (I18n.transliterate → "?").
# All initials are dropped and the name falls back to FALLBACK_HANDLE.
"日本語プロジェクト" => "PROJ", # Japanese: every initial → "?" → fallback
"Plan 日本" => "P" # Mixed: Latin "P" survives; "日" is dropped
}.each do |project_name, expected_handle|
it "generates '#{expected_handle}' from '#{project_name}'" do
create(:project, identifier: "bad-id", name: project_name)