From 8d63737078a56a03a17013c59b4849f325893fdf Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Tue, 12 Sep 2023 13:28:27 -0500 Subject: [PATCH] test: Fix broken exception handler tests --- .../FlurlHttpExceptionHandlerTest.cs | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/tests/Recyclarr.Cli.Tests/Processors/ErrorHandling/FlurlHttpExceptionHandlerTest.cs b/src/tests/Recyclarr.Cli.Tests/Processors/ErrorHandling/FlurlHttpExceptionHandlerTest.cs index e40a10c9..a18b6e3a 100644 --- a/src/tests/Recyclarr.Cli.Tests/Processors/ErrorHandling/FlurlHttpExceptionHandlerTest.cs +++ b/src/tests/Recyclarr.Cli.Tests/Processors/ErrorHandling/FlurlHttpExceptionHandlerTest.cs @@ -22,15 +22,16 @@ public class FlurlHttpExceptionHandlerTest extractor.GetErrorMessage().Returns(responseContent); await sut.ProcessServiceErrorMessages(extractor); - var logs = log.Messages; - - logs.Should().BeEquivalentTo(new[] - { - "Reason: error one", - "Reason: error two" - }, - o => o.WithStrictOrdering() - ); + var logs = log.Messages.ToList(); + + var expectedSubstrings = new[] + { + "error one", + "error two" + }; + + logs.Should().HaveCount(expectedSubstrings.Length); + logs.Zip(expectedSubstrings).Should().OnlyContain(pair => pair.First.Contains(pair.Second)); } [Test, AutoMockData] @@ -45,13 +46,14 @@ public class FlurlHttpExceptionHandlerTest extractor.GetErrorMessage().Returns(responseContent); await sut.ProcessServiceErrorMessages(extractor); - var logs = log.Messages; + var logs = log.Messages.ToList(); + + var expectedSubstrings = new[] + { + "database is locked\ndatabase is locked" + }; - logs.Should().BeEquivalentTo(new[] - { - "Reason: database is locked\ndatabase is locked" - }, - o => o.WithStrictOrdering() - ); + logs.Should().HaveCount(expectedSubstrings.Length); + logs.Zip(expectedSubstrings).Should().OnlyContain(pair => pair.First.Contains(pair.Second)); } }