From acb46ddd0f4f59fd9cf6843b7a07eb5041947137 Mon Sep 17 00:00:00 2001
From: Sebastian Mihalache <sebi.mihalache@gmail.com>
Date: Tue, 13 Nov 2018 16:01:32 +0200
Subject: [PATCH] tests(helper-service): add test for collection without
 handling editor

---
 .../src/tests/fragment.test.js                  | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/packages/component-helper-service/src/tests/fragment.test.js b/packages/component-helper-service/src/tests/fragment.test.js
index b546cbe38..025267531 100644
--- a/packages/component-helper-service/src/tests/fragment.test.js
+++ b/packages/component-helper-service/src/tests/fragment.test.js
@@ -253,5 +253,22 @@ describe('Fragment helper', () => {
       expect(fragmentUsers.length).toBeGreaterThan(0)
       expect(fragmentUsers).toHaveLength(fragment.recommendations.length)
     })
+    it('should return an error when the collection does not have a handling editor', async () => {
+      const { collection } = testFixtures.collections
+      const { fragment } = testFixtures.fragments
+      const fragmentHelper = new Fragment({ fragment })
+
+      delete collection.handlingEditor
+      try {
+        await fragmentHelper.getReviewersAndEditorsData({
+          collection,
+          UserModel: models.User,
+        })
+      } catch (e) {
+        expect(e.message).toEqual(
+          `Collection ${collection.id} does not have a Handling Editor`,
+        )
+      }
+    })
   })
 })
-- 
GitLab