Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Jun 15, 2024
1 parent 38103d3 commit a9a93c8
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions TwitchDownloaderCore.Tests/ToolTests/FilenameServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using TwitchDownloaderCore.Extensions;
using TwitchDownloaderCore.Tools;
using TwitchDownloaderCore.Tools;

namespace TwitchDownloaderCore.Tests.ToolTests
{
Expand Down Expand Up @@ -148,6 +147,17 @@ public void DoesNotInterpretBogusTemplateParameter()
Assert.Equal(EXPECTED, result);
}

[Fact]
public void GetFilenameDoesNotThrow_WhenNullOrDefaultInput()
{
const string TEMPLATE = "{title}-{id}-{date}-{channel}-{trim_start}-{trim_end}-{length}-{views}-{game}-{date_custom=\"s\"}-{trim_start_custom=\"hh\\-mm\\-ss\"}-{trim_end_custom=\"hh\\-mm\\-ss\"}-{length_custom=\"hh\\-mm\\-ss\"}";
const string EXPECTED = "--1-1-01--00-00-00-00-00-00-00-00-00-0--0001-01-01T00_00_00-00-00-00-00-00-00-00-00-00";

var result = FilenameService.GetFilename(TEMPLATE, default, default, default, default, default, default, default, default);

Assert.Equal(EXPECTED, result);
}

[Theory]
[InlineData("\"", """)]
[InlineData("*", "*")]
Expand All @@ -166,6 +176,17 @@ public void CorrectlyReplacesInvalidFilenameCharacters(string str, string expect
Assert.Equal(expected, actual);
}

[Fact]
public void ReplaceInvalidFilenameCharactersDoesNotThrow_WhenNullInput()
{
const string? STR = null;
const string? EXPECTED = null;

var actual = FilenameService.ReplaceInvalidFilenameChars(STR);

Assert.Equal(EXPECTED, actual);
}

[Fact]
public void GetNonCollidingNameWorks_WhenNoCollisionExists()
{
Expand Down

0 comments on commit a9a93c8

Please sign in to comment.