/**
 * Tests for the Notification domain services.
 * @packageDocumentation
 */

import { describe, it, expect, vi, beforeEach } from 'vitest';
import { NotificationService, NotificationError } from './NotificationService';

describe('NotificationService', () => {
  let service: NotificationService;
  let mockPort: any;

  beforeEach(() => {
    mockPort = {
      getAll: vi.fn(),
      getById: vi.fn(),
      create: vi.fn(),
      update: vi.fn(),
      delete: vi.fn(),
    };
    service = new NotificationService(mockPort);
  });

  describe('getAll', () => {
    it('should return all entities', async () => {
      const mockEntities = [{ id: '1' }];
      mockPort.getAll.mockResolvedValue(mockEntities);

      const result = await service.getAll();
      expect(result).toEqual(mockEntities);
    });

    it('should throw error when port fails', async () => {
      mockPort.getAll.mockRejectedValue(new Error());

      await expect(service.getAll()).rejects.toThrow(NotificationError);
    });
  });

  // Add more test cases for other methods...
});