import {
  describe,
  it,
  expect
} from 'vitest';
import { mapComponentNameToDomain, mapStoreSliceToDomain } from './domain-mapping.rules';

describe('mapStoreSliceToDomain', () => {
  it('maps known NgRx slices to domains', () => {
    expect(mapStoreSliceToDomain('messages')).toBe('chat');
    expect(mapStoreSliceToDomain('users')).toBe('users');
    expect(mapStoreSliceToDomain('rooms')).toBe('rooms');
  });

  it('falls back to the slice name for unknown keys', () => {
    expect(mapStoreSliceToDomain('custom')).toBe('custom');
  });
});

describe('mapComponentNameToDomain', () => {
  it('maps component class prefixes to domains', () => {
    expect(mapComponentNameToDomain('VoiceChannelPanelComponent')).toBe('voice-connection');
    expect(mapComponentNameToDomain('DmChatComponent')).toBe('direct-message');
    expect(mapComponentNameToDomain('PluginStoreComponent')).toBe('plugins');
  });

  it('falls back to core for unknown components', () => {
    expect(mapComponentNameToDomain('App')).toBe('core');
  });
});
