import test from 'node:test';
import assert from 'node:assert/strict';
import { buildManagedScheduleServiceMetadata } from './managed-schedule-service.js';

test('buildManagedScheduleServiceMetadata keeps schedule service artifacts in the strict schedule root', () => {
  const metadata = buildManagedScheduleServiceMetadata(10, '반복-정리');

  assert.equal(metadata.serviceKey, 'schedule-10-service');
  assert.equal(metadata.packageName, 'service');
  assert.equal(metadata.relativeDirectory, '.auto_codex/schedule/10');
  assert.equal(metadata.readmePath, '.auto_codex/schedule/10/README.md');
  assert.equal(metadata.sourcePath, '.auto_codex/schedule/10/service.ts');
  assert.equal(metadata.runtimePath, '.auto_codex/schedule/10/service.mjs');
  assert.equal(metadata.manifestPath, '.auto_codex/schedule/10/service-manifest.json');
});

test('buildManagedScheduleServiceMetadata appends the service suffix once for work ids', () => {
  const metadata = buildManagedScheduleServiceMetadata(2, 'stock-alert-high-service');

  assert.equal(metadata.serviceKey, 'schedule-2-stock-alert-high-service');
  assert.equal(metadata.packageName, 'stock-alert-high-service');
});
