刘光辉
12 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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');
  });
});