import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

describe('phase 7 api contract', () => {
  it('documents idle shutdown and billing routes', () => {
    const billingSource = readFileSync(
      join(process.cwd(), 'src', 'billing/billing.controller.ts'),
      'utf8',
    );
    assert.ok(billingSource.includes("'wallet'"));
    assert.ok(billingSource.includes("'usage'"));

    const idleSource = readFileSync(
      join(process.cwd(), 'src', 'servers/idle/idle.service.ts'),
      'utf8',
    );
    assert.ok(idleSource.includes('getIdleStatus'));
    assert.ok(idleSource.includes('extendIdleCountdown'));

    const serversSource = readFileSync(
      join(process.cwd(), 'src', 'servers/servers.controller.ts'),
      'utf8',
    );
    assert.ok(serversSource.includes(':id/idle'));
  });
});
