| 1234567891011121314151617181920212223242526272829 |
- import { createPinia, setActivePinia } from 'pinia';
- import { beforeEach, describe, expect, it } from 'vitest';
- import { agentCatalog } from '../../src/portal/catalog';
- import { usePortalStore } from '../../src/portal/state/portalStore';
- describe('portalStore', () => {
- beforeEach(() => setActivePinia(createPinia()));
- it('opens and closes an agent without changing the current root tab', () => {
- const store = usePortalStore();
- store.switchTab('services');
- store.openAgent('report');
- expect(store.activeTab).toBe('services');
- expect(store.activeAgent).toBe('report');
- store.closeAgent();
- expect(store.activeAgent).toBeNull();
- expect(store.activeTab).toBe('services');
- });
- it('exposes exactly the three P0 agent entries', () => {
- const enabled = agentCatalog.flatMap((cluster) =>
- cluster.stages.flatMap((stage) => stage.agents.filter((agent) => agent.mode)),
- );
- expect(enabled.map((agent) => agent.mode).sort()).toEqual(['registration', 'report', 'tongue']);
- });
- });
|