import test from 'node:test';
import assert from 'node:assert';
import { safeImport } from '../_helpers/path.js';
import { AutoReporter } from '../reporters/AutoReporter.js';


// Auto-Reporter Configuration
const autoReporter = new AutoReporter();

test('DigitalOceanWorkflow.deployArticle dry-run signature', async () => {
  const res = safeImport('DigitalOceanWorkflow');
  if (!res.ok || typeof res.mod.deployArticle !== 'function') {
    console.warn('[SKIP] DigitalOceanWorkflow.deployArticle missing');
    return;
  }
  const { deployArticle } = res.mod;
  const payload = { path:'/articles/slug.html', html:'<article>OK</article>', dryRun:true };
  try {
    const out = await deployArticle(payload);
    // On accepte plusieurs formats de retour ; on vérifie juste que ça n’explose pas en dryRun
    assert.ok(out !== undefined);
  } catch (e) {
    // Si ça échoue car pas de dryRun supporté, on “soft fail”
    console.warn('[SKIP] deployArticle threw (no dryRun support?):', e.message);
  }
});
