import { describe, it, expect } from 'vitest';
import { createDebug, debug } from '../utils/debug';

describe('debug utility', () => {
	describe('createDebug', () => {
		it('returns a callable function', () => {
			const d = createDebug('test-module');
			expect(typeof d).toBe('function');
		});

		it('has .warn sub-logger', () => {
			const d = createDebug('test-module');
			expect(typeof d.warn).toBe('function');
		});

		it('has .error sub-logger', () => {
			const d = createDebug('test-module');
			expect(typeof d.error).toBe('function');
		});

		it('.warn is always enabled', () => {
			const d = createDebug('test-module');
			expect(d.warn.enabled).toBe(true);
		});

		it('.error is always enabled', () => {
			const d = createDebug('test-module');
			expect(d.error.enabled).toBe(true);
		});
	});

	describe('pre-configured loggers', () => {
		it('exposes graph loggers', () => {
			expect(typeof debug.graph.node).toBe('function');
			expect(typeof debug.graph.edge).toBe('function');
			expect(typeof debug.graph.sync).toBe('function');
		});

		it('exposes ui loggers', () => {
			expect(typeof debug.ui.selection).toBe('function');
			expect(typeof debug.ui.drag).toBe('function');
		});

		it('exposes viewport logger', () => {
			expect(typeof debug.viewport).toBe('function');
		});
	});
});
