import assert from 'node:assert/strict';
import test from 'node:test';
import { createDuplicateVersionLabel } from './service';

test('createDuplicateVersionLabel creates draft label first', () => {
  const label = createDuplicateVersionLabel(['1.0', '2.0'], '2.0');
  assert.equal(label, '2.0-draft');
});

test('createDuplicateVersionLabel increments copy suffix when draft already exists', () => {
  const label = createDuplicateVersionLabel(
    ['2.0', '2.0-draft', '2.0-copy-1'],
    '2.0',
  );
  assert.equal(label, '2.0-copy-2');
});
