import { describe, it, expect } from 'vitest';
import { defaultLightStyles, defaultDarkStyles, mergeWithDefaults } from '../styles/canvas-styles';

describe('canvas-styles', () => {
	it('defaultLightStyles has all 5 sections', () => {
		expect(defaultLightStyles.background).toBeDefined();
		expect(defaultLightStyles.grid).toBeDefined();
		expect(defaultLightStyles.axes).toBeDefined();
		expect(defaultLightStyles.nodes).toBeDefined();
		expect(defaultLightStyles.edges).toBeDefined();
	});

	it('defaultDarkStyles has all 5 sections', () => {
		expect(defaultDarkStyles.background).toBeDefined();
		expect(defaultDarkStyles.grid).toBeDefined();
		expect(defaultDarkStyles.axes).toBeDefined();
		expect(defaultDarkStyles.nodes).toBeDefined();
		expect(defaultDarkStyles.edges).toBeDefined();
	});

	it('mergeWithDefaults returns defaults when no user styles', () => {
		const result = mergeWithDefaults(undefined, false);
		expect(result).toBe(defaultLightStyles);
	});

	it('mergeWithDefaults returns dark defaults when isDark', () => {
		const result = mergeWithDefaults(null, true);
		expect(result).toBe(defaultDarkStyles);
	});

	it('mergeWithDefaults merges user overrides', () => {
		const result = mergeWithDefaults({ background: { color: '#ff0000' } }, false);
		expect(result.background.color).toBe('#ff0000');
		expect(result.background.pattern).toBe(defaultLightStyles.background.pattern);
	});

	it('light and dark themes have different background colors', () => {
		expect(defaultLightStyles.background.color).not.toBe(defaultDarkStyles.background.color);
	});

	it('default edge pathType is bezier', () => {
		expect(defaultLightStyles.edges.pathType).toBe('bezier');
		expect(defaultDarkStyles.edges.pathType).toBe('bezier');
	});
});
