import { describe, expect, it } from 'vitest';
import {
  getRequiredParentLevel,
  levelDepth,
} from '@/business/tenant-create/selectors';

describe('tenant-create selectors', () => {
  describe('getRequiredParentLevel', () => {
    it('maps each tenant type to its parent level', () => {
      expect(getRequiredParentLevel('organization')).toBeNull();
      expect(getRequiredParentLevel('school')).toBe('organization');
      expect(getRequiredParentLevel('campus')).toBe('school');
      expect(getRequiredParentLevel('class')).toBe('campus');
    });
  });

  describe('levelDepth', () => {
    it('ranks tenant levels (global = 0)', () => {
      expect(levelDepth('global')).toBe(0);
      expect(levelDepth('external')).toBe(0);
      expect(levelDepth('organization')).toBe(1);
      expect(levelDepth('school')).toBe(2);
      expect(levelDepth('campus')).toBe(3);
      expect(levelDepth('class')).toBe(4);
    });
  });
});
