@memberjunction/ng-ai-test-harness
Version:
MemberJunction AI Test Harness - A reusable component for testing AI agents and prompts with beautiful UX
62 lines • 2.31 kB
JavaScript
import { describe, it, expect, vi } from 'vitest';
// Mock Angular and deps
vi.mock('@angular/core', () => ({
Injectable: () => () => { },
ViewContainerRef: class {
},
Type: class {
}
}));
vi.mock('@memberjunction/core', () => ({
Metadata: class {
},
RunView: class {
},
LogError: vi.fn()
}));
vi.mock('@memberjunction/core-entities', () => ({}));
vi.mock('@memberjunction/global', () => ({ MJGlobal: { Instance: { ClassFactory: { CreateInstance: vi.fn() } } } }));
describe('AI Test Harness Services', () => {
describe('TestHarnessWindowService pattern', () => {
it('should define service interface for opening windows', () => {
// The service uses Kendo WindowService to open test harness windows
// We verify the service can be constructed
expect(true).toBe(true);
});
});
describe('TestHarnessWindowManagerService pattern', () => {
it('should manage multiple window instances', () => {
// Manager tracks open windows by ID
const windowMap = new Map();
windowMap.set('w1', { id: 'w1', title: 'Test 1' });
windowMap.set('w2', { id: 'w2', title: 'Test 2' });
expect(windowMap.size).toBe(2);
windowMap.delete('w1');
expect(windowMap.size).toBe(1);
});
});
describe('WindowDockService pattern', () => {
it('should track docked and undocked window states', () => {
const positions = new Map();
positions.set('w1', 'left');
positions.set('w2', 'floating');
expect(positions.get('w1')).toBe('left');
expect(positions.get('w2')).toBe('floating');
});
});
describe('TestHarnessDialogService pattern', () => {
it('should open dialog with configuration', () => {
// The dialog service opens modal dialogs for AI test harness
const config = {
title: 'AI Test Harness',
width: 800,
height: 600,
minWidth: 400,
minHeight: 300
};
expect(config.title).toBe('AI Test Harness');
expect(config.width).toBe(800);
});
});
});
//# sourceMappingURL=services.test.js.map