From b4a77c6a95b5e50532e629b0eb8ee696fce25681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20=C5=A0est=C3=A1k?= Date: Tue, 7 Nov 2023 14:27:37 +0100 Subject: [PATCH] Fix AddonExecutionResult monoid identity --- .../scala/docspell/addons/AddonExecutionResult.scala | 2 +- .../scala/docspell/addons/AddonExecutorTest.scala | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/addonlib/src/main/scala/docspell/addons/AddonExecutionResult.scala b/modules/addonlib/src/main/scala/docspell/addons/AddonExecutionResult.scala index 08b3fd7b..bd22c4e9 100644 --- a/modules/addonlib/src/main/scala/docspell/addons/AddonExecutionResult.scala +++ b/modules/addonlib/src/main/scala/docspell/addons/AddonExecutionResult.scala @@ -20,7 +20,7 @@ case class AddonExecutionResult( object AddonExecutionResult { val empty: AddonExecutionResult = - AddonExecutionResult(Nil, false) + AddonExecutionResult(Nil, pure = true) def combine(a: AddonExecutionResult, b: AddonExecutionResult): AddonExecutionResult = AddonExecutionResult( diff --git a/modules/addonlib/src/test/scala/docspell/addons/AddonExecutorTest.scala b/modules/addonlib/src/test/scala/docspell/addons/AddonExecutorTest.scala index d18556a3..ec2bd862 100644 --- a/modules/addonlib/src/test/scala/docspell/addons/AddonExecutorTest.scala +++ b/modules/addonlib/src/test/scala/docspell/addons/AddonExecutorTest.scala @@ -136,4 +136,15 @@ class AddonExecutorTest extends CatsEffectSuite with Fixtures with TestLoggingCo assertEquals(res.addonResults(1), AddonResult.success(testOut2)) } } + + test("AddonExecutionResult's monoid") { + assert( + AddonExecutionResult.executionResultMonoid + .combine( + AddonExecutionResult.empty, + AddonExecutionResult(Nil, true) + ) + .pure + ) + } }