import { describe, it, expect } from 'vitest';
import { instanceIdsFor } from './instance-id';

describe('instanceIdsFor', () => {
  it('derives N instance_ids from replicaStates + deployment id', () => {
    expect(instanceIdsFor({
      id: 'aaa11111-2222-3333-4444-555555555555',
      replicaStates: [{ index: 0 }, { index: 1 }, { index: 2 }],
    } as any, 'prod', 'my-app')).toEqual([
      'prod-my-app-0-aaa11111',
      'prod-my-app-1-aaa11111',
      'prod-my-app-2-aaa11111',
    ]);
  });

  it('returns empty array when no replicas', () => {
    expect(instanceIdsFor({ id: 'x', replicaStates: [] } as any, 'e', 'a')).toEqual([]);
  });
});
