Skip to content

Commit 5ba2f11

Browse files
committed
Fixed privacty test to work on all platforms.
1 parent 3c9ba23 commit 5ba2f11

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

tests/Munin.Core.Tests/PrivacyServiceTests.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,17 @@ public void AnonymizeChannelName_WithInvalidChars_SanitizesWhenDisabled()
121121
{
122122
var service = new PrivacyService { IsEnabled = false };
123123

124-
var result = service.AnonymizeChannelName("#test<>|");
125-
126-
result.Should().NotContain("<");
127-
result.Should().NotContain(">");
128-
result.Should().NotContain("|");
124+
// Use characters that are invalid on all platforms
125+
var channelWithInvalidChars = "#test" + new string(Path.GetInvalidFileNameChars().Take(3).ToArray());
126+
var result = service.AnonymizeChannelName(channelWithInvalidChars);
127+
128+
// Verify invalid chars are replaced with underscores
129+
var invalidChars = Path.GetInvalidFileNameChars();
130+
foreach (var invalidChar in invalidChars.Take(3))
131+
{
132+
result.Should().NotContain(invalidChar.ToString());
133+
}
134+
result.Should().Contain("_"); // Should have underscores as replacements
129135
}
130136

131137
[Fact]

0 commit comments

Comments
 (0)