From 51ec322d94e5c5f38a8a15936c00a7491507a7d0 Mon Sep 17 00:00:00 2001 From: Adityavanjre <66417028+Adityavanjre@users.noreply.github.com> Date: Sun, 8 Mar 2026 08:29:48 +0530 Subject: [PATCH] Fix backend unit tests for updated service dependencies --- .../src/accounting/services/ledger.service.spec.ts | 8 ++++++++ nexus/backend/src/app.controller.spec.ts | 4 ++-- .../backend/src/system/services/audit-collab-001.spec.ts | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/nexus/backend/src/accounting/services/ledger.service.spec.ts b/nexus/backend/src/accounting/services/ledger.service.spec.ts index f4b21eb7..408697f1 100644 --- a/nexus/backend/src/accounting/services/ledger.service.spec.ts +++ b/nexus/backend/src/accounting/services/ledger.service.spec.ts @@ -5,6 +5,7 @@ import { PrismaService } from '../../prisma/prisma.service'; import { BadRequestException } from '@nestjs/common'; import { Decimal } from '@prisma/client/runtime/library'; import { TraceService } from '../../common/services/trace.service'; +import { BillingService } from '../../system/services/billing.service'; describe('LedgerService (Financial Integrity)', () => { let service: LedgerService; @@ -39,6 +40,13 @@ describe('LedgerService (Financial Integrity)', () => { LedgerService, { provide: PrismaService, useValue: mockPrisma }, { provide: TraceService, useValue: mockTrace }, + { + provide: BillingService, + useValue: { + getPlanByTenant: jest.fn().mockResolvedValue('Enterprise'), + checkQuota: jest.fn().mockResolvedValue(undefined), + }, + }, { provide: 'CACHE_MANAGER', useValue: { get: jest.fn(), set: jest.fn() } }, ], }).compile(); diff --git a/nexus/backend/src/app.controller.spec.ts b/nexus/backend/src/app.controller.spec.ts index 217a6e77..d065333e 100644 --- a/nexus/backend/src/app.controller.spec.ts +++ b/nexus/backend/src/app.controller.spec.ts @@ -15,8 +15,8 @@ describe('AppController', () => { }); describe('root', () => { - it('should return "Hello World!"', () => { - expect(appController.getHello()).toBe('Nexus ERP Engine v2.0 is Online 🟢'); + it('should return operational status message', () => { + expect(appController.getHello()).toBe('Nexus ERP API Gateway is Operational'); }); }); }); diff --git a/nexus/backend/src/system/services/audit-collab-001.spec.ts b/nexus/backend/src/system/services/audit-collab-001.spec.ts index 0b875aa0..5e117257 100644 --- a/nexus/backend/src/system/services/audit-collab-001.spec.ts +++ b/nexus/backend/src/system/services/audit-collab-001.spec.ts @@ -4,6 +4,7 @@ import { CollaborationService } from './collaboration.service'; import { PrismaService } from '../../prisma/prisma.service'; import { AuditService } from './audit.service'; import { NotFoundException } from '@nestjs/common'; +import { CollaborationGateway } from '../gateways/collaboration.gateway'; describe('CollaborationService: TEN-001 Audit', () => { let service: CollaborationService; @@ -20,12 +21,18 @@ describe('CollaborationService: TEN-001 Audit', () => { log: jest.fn(), }; + const mockGateway = { + broadcastCommentAdded: jest.fn(), + broadcastCommentDeleted: jest.fn(), + }; + beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ providers: [ CollaborationService, { provide: PrismaService, useValue: mockPrisma }, { provide: AuditService, useValue: mockAudit }, + { provide: CollaborationGateway, useValue: mockGateway }, ], }).compile();