All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.client.vue.test.unit.common.secondary.ConsoleLogger.spec.ts.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
import { describe, it, expect, vi } from 'vitest';

import ConsoleLogger from '@/common/secondary/ConsoleLogger';

describe('ConsoleLogger', () => {
  it('should log an error', () => {
    const logger = {
      error: vi.fn(),
    };
    const consoleLogger = new ConsoleLogger(logger as any);
    const error = new Error('Error message');

    consoleLogger.error('An error occurs', error);

    expect(logger.error).toHaveBeenCalledTimes(1);
    expect(logger.error).toBeCalledWith('An error occurs\n', error);
  });
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy