mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-06 07:36:01 +02:00
Add unit tests for various services and functionalities
- Implement tests for ChatLine utility methods including color tag detection and stripping. - Create comprehensive tests for CommandHandler to validate command handling and status updates. - Add tests for DataMigrationService to ensure correct ANSI to color tag conversion. - Enhance FileValidationHelperTests with audio file validation tests. - Introduce ImageToAsciiServiceTests to verify image dimension retrieval. - Develop IrcMessageFormatterTests for message formatting and color tag conversion. - Add JwtTokenServiceTests to validate JWT token generation and hashing. - Implement LinkEmbedServiceTests for URL extraction and Open Graph tag parsing. - Update EchoHub.Tests.csproj to include necessary project references.
This commit is contained in:
@@ -53,4 +53,48 @@ public class FileValidationHelperTests
|
||||
FileValidationHelper.IsValidImage(stream);
|
||||
Assert.Equal(0, stream.Position);
|
||||
}
|
||||
|
||||
// ── IsAudioFile tests ─────────────────────────────────────────────
|
||||
|
||||
[Theory]
|
||||
[InlineData("song.mp3")]
|
||||
[InlineData("track.wav")]
|
||||
[InlineData("audio.ogg")]
|
||||
[InlineData("music.flac")]
|
||||
[InlineData("clip.aac")]
|
||||
[InlineData("podcast.m4a")]
|
||||
[InlineData("old.wma")]
|
||||
public void IsAudioFile_SupportedExtensions_ReturnsTrue(string fileName)
|
||||
{
|
||||
Assert.True(FileValidationHelper.IsAudioFile(fileName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("song.MP3")]
|
||||
[InlineData("track.Wav")]
|
||||
[InlineData("audio.OGG")]
|
||||
[InlineData("music.FLAC")]
|
||||
public void IsAudioFile_CaseInsensitive_ReturnsTrue(string fileName)
|
||||
{
|
||||
Assert.True(FileValidationHelper.IsAudioFile(fileName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("document.txt")]
|
||||
[InlineData("report.pdf")]
|
||||
[InlineData("app.exe")]
|
||||
[InlineData("photo.jpg")]
|
||||
[InlineData("image.png")]
|
||||
public void IsAudioFile_NonAudioExtension_ReturnsFalse(string fileName)
|
||||
{
|
||||
Assert.False(FileValidationHelper.IsAudioFile(fileName));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData("noextension")]
|
||||
public void IsAudioFile_EmptyOrNoExtension_ReturnsFalse(string fileName)
|
||||
{
|
||||
Assert.False(FileValidationHelper.IsAudioFile(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user