test: comprehensive coverage for accented character names#123
Conversation
Add tests for umlauts, acute/grave accents, circumflex, cedilla, tilde, ring, and ligatures — both bare names and realm-qualified. Also add end-to-end AddCommunityPlayer tests with accented names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request significantly expands the test suite for CommunityService, adding comprehensive validation for community names containing various accented characters, ligatures, and diacritics. It also introduces tests for adding players with accented names to the roster. The review feedback suggests further strengthening these tests by verifying case-insensitive duplicate prevention—particularly important given Lua 5.1's lack of native UTF-8 support in string.lower()—and ensuring roster size assertions are consistently applied to prevent unexpected entries.
| it("should add accented name and normalize with realm", function() | ||
| local ok = WHLSN:AddCommunityPlayer("Müzaka") | ||
| assert.is_true(ok) | ||
| assert.equals(1, #WHLSN.db.profile.communityRoster) | ||
| assert.equals("Müzaka-Illidan", WHLSN.db.profile.communityRoster[1].name) | ||
| end) |
There was a problem hiding this comment.
The test suite for AddCommunityPlayer should include a case-insensitivity check for accented names to ensure the duplicate prevention logic works correctly for these characters. In Lua 5.1, string.lower() is not UTF-8 aware, which often leads to bugs where names like Müzaka and MÜZAKA are treated as distinct entries. Adding this test case would verify if the implementation handles this correctly or if a more robust normalization (like a custom UTF-8 lower function) is needed.
it("should add accented name and normalize with realm", function()
local ok = WHLSN:AddCommunityPlayer("Müzaka")
assert.is_true(ok)
assert.equals(1, #WHLSN.db.profile.communityRoster)
assert.equals("Müzaka-Illidan", WHLSN.db.profile.communityRoster[1].name)
-- Verify case-insensitive duplicate prevention for accented names
local ok2 = WHLSN:AddCommunityPlayer("MÜZAKA")
assert.is_false(ok2)
assert.equals(1, #WHLSN.db.profile.communityRoster)
end)
There was a problem hiding this comment.
WoW enforces consistent character name casing (first letter uppercase, rest lowercase), so a case-differing accented name like MÜZAKA vs Müzaka is not a real-world scenario. Additionally, Lua 5.1's string.lower() isn't UTF-8 aware, so adding this assertion would actually fail — and fixing that with a custom UTF-8 lower function would be over-engineering for a case that can't occur in practice. Skipping this one.
| it("should add accented name with realm as-is", function() | ||
| local ok = WHLSN:AddCommunityPlayer("Élowen-Stormrage") | ||
| assert.is_true(ok) | ||
| assert.equals("Élowen-Stormrage", WHLSN.db.profile.communityRoster[1].name) | ||
| end) |
There was a problem hiding this comment.
For consistency and thoroughness, this test should also verify that the roster size is exactly 1 after the addition, ensuring no unexpected entries were created.
it("should add accented name with realm as-is", function()
local ok = WHLSN:AddCommunityPlayer("Élowen-Stormrage")
assert.is_true(ok)
assert.equals(1, #WHLSN.db.profile.communityRoster)
assert.equals("Élowen-Stormrage", WHLSN.db.profile.communityRoster[1].name)
end)
There was a problem hiding this comment.
Good catch — added the roster size assertion in 87e20cd.
Addresses PR review comment — verify roster count after adding an accented name with an explicit realm. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
AddCommunityPlayertests verifying accented names are normalized correctlyTest plan
🤖 Generated with Claude Code