~jan0sch/smederee

Showing details for patch 511cccfdb2f838c9dbe80433e8f81310e19cde66.
2023-12-29 (Fri), 9:32 AM - Jens Grassel - 511cccfdb2f838c9dbe80433e8f81310e19cde66

email: Add test for data generators

Summary of changes
1 files added
  • modules/email/src/test/scala/de/smederee/email/GeneratorsTest.scala
diff -rN -u old-smederee/modules/email/src/test/scala/de/smederee/email/GeneratorsTest.scala new-smederee/modules/email/src/test/scala/de/smederee/email/GeneratorsTest.scala
--- old-smederee/modules/email/src/test/scala/de/smederee/email/GeneratorsTest.scala	1970-01-01 00:00:00.000000000 +0000
+++ new-smederee/modules/email/src/test/scala/de/smederee/email/GeneratorsTest.scala	2025-01-13 07:59:10.758990308 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022  Contributors as noted in the AUTHORS.md file
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package de.smederee.email
+
+import cats.syntax.all.*
+import de.smederee.email.Generators.given
+
+import munit.*
+
+import org.scalacheck.Prop.*
+
+final class GeneratorsTest extends ScalaCheckSuite {
+    property("FromAddress is always syntactically correct") {
+        forAll { (addr: FromAddress) =>
+            assertEquals(FromAddress.from(addr.toString), addr.some)
+        }
+    }
+
+    property("SubjectLine is always syntactically correct") {
+        forAll { (subject: SubjectLine) =>
+            assertEquals(SubjectLine.from(subject.toString), subject.some)
+        }
+    }
+
+    property("ToAddress is always syntactically correct") {
+        forAll { (addr: ToAddress) =>
+            assertEquals(ToAddress.from(addr.toString), addr.some)
+        }
+    }
+}