Skip to content

Commit

Permalink
chore: skip on empty input
Browse files Browse the repository at this point in the history
  • Loading branch information
guitarrapc committed Dec 17, 2024
1 parent 6abba7c commit dd91016
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Actions.Tests/FileExistsCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace Actions.Tests;
public class FileExistsCommandTest
{
[Fact]
public void EmptyPathTest()
public void SkipEmptyPathTest()
{
var command = new FileExsistsCommand("");
Assert.Throws<ActionCommandException>(() => command.Validate());
command.Validate();
}

[Fact]
Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Commands/FileExsistsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ public void Validate()
{
// do nothing for empty input
if (string.IsNullOrWhiteSpace(pathPattern))
{
throw new ActionCommandException("Input path was empty.");
}
return;

// Handle glob path pattern.
// /foo/bar/**/*
Expand Down
1 change: 1 addition & 0 deletions src/Actions/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void ValidateFileExists(string pathPattern)
Console.WriteLine($"Validating path, {pathPattern}");
var command = new FileExsistsCommand(pathPattern);
command.Validate();

Console.WriteLine($"Completed ...");
}

Expand Down

0 comments on commit dd91016

Please sign in to comment.