import assert from 'node:assert/strict';
import test from 'node:test';
import { canSubmitReleaseForm, getReleaseProgressWarning } from './version-release';

test('getReleaseProgressWarning warns when version progress is below 100 percent', () => {
  assert.equal(
    getReleaseProgressWarning(87),
    '当前版本进度 87%，仍有未完成事项。确认发版会将版本标记为已发布。',
  );
});

test('getReleaseProgressWarning returns empty when version progress is complete', () => {
  assert.equal(getReleaseProgressWarning(100), '');
});

test('canSubmitReleaseForm requires release date', () => {
  assert.equal(canSubmitReleaseForm(''), false);
  assert.equal(canSubmitReleaseForm('2026-07-15'), true);
});
