diff --git a/src/readers/insightProcessor.ts b/src/readers/insightProcessor.ts
index 71014ea1bd75cbed02dab9f764bf143caac55d3a..986a028914996c4a1e6f4680642a086ca0a2b1c1 100644
--- a/src/readers/insightProcessor.ts
+++ b/src/readers/insightProcessor.ts
@@ -12,6 +12,7 @@ import { diffCheck } from './diffCheck';
 import { VariableNode } from '../utils/lexical';
 import { populateTemplate } from '../utils/insights';
 import { RabbitMqBroker } from 'ts-common/rabbitMq';
+import { validateInsight } from '../utils/insights/validateInsight';
 
 const dom = new JSDOM();
 function setUpDom() {
@@ -37,7 +38,7 @@ function setUpDom() {
 export const insightProcessor = async () => {
   if (mail == null) {
     log.warn('Mail is not configured. Insight processor will be disabled');
-    return;
+    //return;
   }
 
   log.info('Starting insight processor');
@@ -52,18 +53,8 @@ export const insightProcessor = async () => {
 
   await insightProcessorConsumer.startConsuming<{ insight: InsightModel; force: boolean }>('query-service', async (message, headers) => {
     let insight = message.insight;
-    if (insight == null || insight.template == null || insight.userId == null || insight.saveStateId == null) {
-      log.error('Invalid Insight received in insightProcessorConsumer:', insight);
-      return;
-    }
-
-    if (insight.alarmMode === 'disabled' && !message.force) {
-      log.debug('Alarm mode is disabled', insight.id);
-      return;
-    }
 
-    if (insight.recipients == null || insight.recipients.length === 0) {
-      log.debug('No recipients found in the insight, skipping');
+    if (!validateInsight(insight, message.force)) {
       return;
     }
 
@@ -81,8 +72,7 @@ export const insightProcessor = async () => {
       editor.setEditorState(state);
     });
 
-    if (insight.userId == null) return;
-    const ss = await ums.getUserSaveState(insight.userId, insight.saveStateId);
+    const ss = await ums.getUserSaveState(insight.userId as number, insight.saveStateId);
 
     const queries = ss.queryStates.openQueryArray;
     const visualizations = ss.visualizations.openVisualizationArray;
@@ -106,8 +96,7 @@ export const insightProcessor = async () => {
           insight = statCheck(insight, result);
         }
 
-        if (insight.userId == null) return; // fixes ts but never is the case
-        await ums.updateInsight(insight.userId, insight.id, insight);
+        await ums.updateInsight(insight.userId as number, insight.id, insight);
 
         if (insight.status || message.force) {
           if (insight.status) log.debug('Insight passed the check');
diff --git a/src/tests/insights/validateInsight.test.ts b/src/tests/insights/validateInsight.test.ts
new file mode 100644
index 0000000000000000000000000000000000000000..15a06c8d05305c89e1f247fc6160816d053a25bc
--- /dev/null
+++ b/src/tests/insights/validateInsight.test.ts
@@ -0,0 +1,63 @@
+import { describe, it, expect, vi } from 'vitest';
+import { validateInsight } from '../../utils/insights/validateInsight';
+import type { InsightModel, InsightRequest } from 'ts-common';
+import { log } from '../../logger';
+import { Logger } from 'ts-common';
+
+Logger.excludedOwners.push('ts-common');
+Logger.excludedOwners.push('query-service');
+
+describe('validateInsight', () => {
+  const baseInsight: InsightModel = {
+    id: 1,
+    name: 'Test Insight',
+    description: 'A test insight',
+    recipients: ['user@example.com'],
+    frequency: 'daily',
+    saveStateId: '1c9351d5-0dc5-4c08-979f-829f9f83bb29',
+    userId: 42,
+    status: true,
+    type: 'report',
+    template: 'this is an email',
+    alarmMode: 'conditional',
+    createdAt: '2023-12-12',
+    updatedAt: '2023-12-12',
+    conditionsCheck: [{ nodeLabel: 'Movie', statistic: 'Count', operator: '>', value: 50 }],
+  };
+
+  it('should return true for a valid insight', () => {
+    expect(validateInsight(baseInsight, true)).toBe(true);
+  });
+
+  it('should return false if insight is null', () => {
+    expect(validateInsight(null as unknown as InsightModel, true)).toBe(false);
+  });
+
+  it('should return false if required fields are missing', () => {
+    const invalidInsight = { ...baseInsight, template: null };
+    expect(validateInsight(invalidInsight as unknown as InsightModel, true)).toBe(false);
+  });
+
+  it('should return false if alarm mode is disabled and force is false', () => {
+    const disabledInsight: InsightModel = {
+      ...baseInsight,
+      alarmMode: 'disabled',
+    };
+    expect(validateInsight(disabledInsight, false)).toBe(false);
+  });
+
+  it('should return true if alarm mode is disabled but force is true', () => {
+    const disabledInsight: InsightModel = { ...baseInsight, alarmMode: 'disabled' };
+    expect(validateInsight(disabledInsight, true)).toBe(true);
+  });
+
+  it('should return false if no recipients are provided', () => {
+    const noRecipientsInsight = { ...baseInsight, recipients: [] };
+    expect(validateInsight(noRecipientsInsight, true)).toBe(false);
+  });
+
+  it('should return false if userId is null', () => {
+    const noUserInsight: InsightModel = { ...baseInsight, userId: null as unknown as number };
+    expect(validateInsight(noUserInsight, true)).toBe(false);
+  });
+});
diff --git a/src/utils/insights/validateInsight.ts b/src/utils/insights/validateInsight.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6d04fa7fd8978e1b7dbc59ff365eec8e0bc98971
--- /dev/null
+++ b/src/utils/insights/validateInsight.ts
@@ -0,0 +1,21 @@
+import { type InsightModel } from 'ts-common';
+import { log } from '../../logger';
+
+export function validateInsight(insight: InsightModel, force: boolean) {
+  if (!insight || insight.userId == null || !insight.template || !insight.userId || !insight.saveStateId) {
+    log.error('Invalid Insight received in insightProcessorConsumer:', insight);
+    return false;
+  }
+
+  if (insight.alarmMode === 'disabled' && !force) {
+    log.debug('Alarm mode is disabled', insight.id);
+    return false;
+  }
+
+  if (!insight.recipients || insight.recipients.length === 0) {
+    log.debug('No recipients found in the insight, skipping');
+    return false;
+  }
+
+  return true;
+}