import assert from 'node:assert/strict';
import test from 'node:test';
import { getVersionReadonlyNotice, isVersionReadonly } from './version-status';

test('isVersionReadonly locks released closed and paused versions', () => {
  assert.equal(isVersionReadonly('released'), true);
  assert.equal(isVersionReadonly('closed'), true);
  assert.equal(isVersionReadonly('paused'), true);
});

test('isVersionReadonly allows planned and developing versions to be edited', () => {
  assert.equal(isVersionReadonly('planned'), false);
  assert.equal(isVersionReadonly('developing'), false);
});

test('getVersionReadonlyNotice explains locked version task actions', () => {
  assert.equal(getVersionReadonlyNotice('released'), '已发布版本不可编辑或删除任务');
  assert.equal(getVersionReadonlyNotice('paused'), '已暂停版本不可编辑或删除任务');
  assert.equal(getVersionReadonlyNotice('closed'), '已关闭版本不可编辑或删除任务');
});

test('getVersionReadonlyNotice stays empty for editable versions', () => {
  assert.equal(getVersionReadonlyNotice('developing'), null);
  assert.equal(getVersionReadonlyNotice('planned'), null);
});
