Files
advanced-camera-card/tests/utils/debug.test.ts
T
2023-06-16 19:36:45 -07:00

18 lines
539 B
TypeScript

import { afterAll, describe, expect, it, vi } from 'vitest';
import { log } from '../../src/utils/debug.js';
describe('log', () => {
const spy = vi.spyOn(global.console, 'debug').mockReturnValue(undefined);
afterAll(() => {
vi.restoreAllMocks();
});
it('should do nothing without debug logging set', () => {
log({}, 'foo');
expect(spy).not.toBeCalled();
});
it('should log debug when appropriately configured', () => {
log({ debug: { logging: true } }, 'foo');
expect(spy).toBeCalledWith('foo');
});
});