import { describe, it, expect } from 'vitest';
import { getAction } from '../core/action-registry';
import { BuiltInActionId, ActionCategory } from '../core/settings-types';

// Built-in actions are auto-registered when action-registry is imported.
// We test that the actions from actions-viewport.ts were registered correctly.

describe('actions-viewport (registered)', () => {
	describe('viewport actions', () => {
		it('FitToView and FitAllToView are registered', () => {
			expect(getAction(BuiltInActionId.FitToView)).toBeDefined();
			expect(getAction(BuiltInActionId.FitAllToView)).toBeDefined();
		});

		it('CenterOnNode and ResetViewport are registered', () => {
			expect(getAction(BuiltInActionId.CenterOnNode)).toBeDefined();
			expect(getAction(BuiltInActionId.ResetViewport)).toBeDefined();
		});

		it('viewport actions have correct category', () => {
			expect(getAction(BuiltInActionId.FitToView)!.category).toBe(ActionCategory.Viewport);
			expect(getAction(BuiltInActionId.ResetViewport)!.category).toBe(ActionCategory.Viewport);
		});
	});

	describe('history actions', () => {
		it('Undo and Redo are registered', () => {
			expect(getAction(BuiltInActionId.Undo)).toBeDefined();
			expect(getAction(BuiltInActionId.Redo)).toBeDefined();
		});

		it('ApplyForceLayout is registered', () => {
			expect(getAction(BuiltInActionId.ApplyForceLayout)).toBeDefined();
		});

		it('history actions have correct category', () => {
			expect(getAction(BuiltInActionId.Undo)!.category).toBe(ActionCategory.History);
		});
	});
});
