import { describe, expect, it } from 'vitest';

import { nextRevisionLabel } from '../revisionRules';

describe('nextRevisionLabel', () => {
  it('increments the numeric part while preserving padding', () => {
    expect(nextRevisionLabel('D(00)', 1)).toBe('D(01)');
    expect(nextRevisionLabel('D(09)', 10)).toBe('D(10)');
  });

  it('increments the last numeric part of a dotted version', () => {
    expect(nextRevisionLabel('V1.0', 1)).toBe('V1.1');
  });

  it('falls back to a revision suffix when no number exists', () => {
    expect(nextRevisionLabel('正式版', 3)).toBe('正式版-R4');
    expect(nextRevisionLabel(undefined, 1)).toBe('v2');
  });
});
