From 590b06fc86b53f834f1ebf8224510f645402637c Mon Sep 17 00:00:00 2001 From: ProfessionalUwU Date: Tue, 20 Jun 2023 00:35:31 +0200 Subject: [PATCH] Fix checkForNewerStuffTest Fixed the tests that stopped working after refactoring #4 --- src/Pacserver.Tests/checkForNewerStuffTest.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Pacserver.Tests/checkForNewerStuffTest.cs b/src/Pacserver.Tests/checkForNewerStuffTest.cs index 41ef7de..36c9e31 100644 --- a/src/Pacserver.Tests/checkForNewerStuffTest.cs +++ b/src/Pacserver.Tests/checkForNewerStuffTest.cs @@ -7,9 +7,11 @@ public class checkForNewerStuffTest { public void checkForNewerPackages_throwsExceptionIfNoFilesExist() { // Arrange PacserverUtils utils = new PacserverUtils(); + File.Delete("/tmp/packages_before.txt"); + File.Delete("/tmp/packages_after.txt"); // Act - Action act = () => utils.diff("/tmp/before_update.txt", "/tmp/after_update.txt"); + Action act = () => utils.diff("/tmp/packages_before.txt", "/tmp/packages_after.txt"); // Assert act.Should().Throw().WithMessage("Necessary files could not be found"); @@ -26,8 +28,8 @@ public class checkForNewerStuffTest { utils.getEveryPackageNameAndVersion("after", "/tmp/packages_after.txt"); // Assert - File.Exists("/tmp/before_update.txt").Should().BeTrue(); - File.Exists("/tmp/after_update.txt").Should().BeTrue(); + File.Exists("/tmp/packages_before.txt").Should().BeTrue(); + File.Exists("/tmp/packages_before.txt").Should().BeTrue(); } [Fact] @@ -45,16 +47,14 @@ public class checkForNewerStuffTest { } [Fact] - public void getEveryPackageNameAndVersionViaFolderName_throwsExceptionIfListIsEmpty() { + public void getEveryPackageNameAndVersionViaFolderName_throwsExceptionIfModeIsNotValid() { // Arrange PacserverUtils utils = new PacserverUtils(); - Directory.CreateDirectory("/tmp/local"); - utils.pacmanDatabaseDirectory = "/tmp/"; // Act - Action act = () => utils.getEveryPackageNameAndVersion("before", "/tmp/packages_before.txt"); + Action act = () => utils.getEveryPackageNameAndVersion("test", "/tmp/test.txt"); // Assert - act.Should().Throw().WithMessage("How did you execute this without any packages?"); + act.Should().Throw().WithMessage("No valid mode was given. Valid modes are before and after"); } } \ No newline at end of file