✨ feat(vscode): 摘修复可按作者筛选,高亮发布点后第一条

This commit is contained in:
cruldra committed 2026-09-01 19:15:32 +08:00
1 parent 54fc2ead4c
commit beb7750eac
9 files changed
+137 -33

No files matched your search

@@ -0,0 +1,37 @@
import { describe, expect, it } from 'vitest'
import type { ReleaseCommitGroup } from './messages'
import { filterCherryPickGroups, uniqueAuthors } from './cherryPickView'
const groups: ReleaseCommitGroup[] = [
{
title: '未关联 PR',
authors: ['cruldra'],
commits: [
{ sha: 'a', subject: 'chore: lone', author: 'cruldra', date: '2026-09-01', body: '' },
],
},
{
pr: 260,
title: '连续包月',
authors: ['chehongweo', 'cruldra'],
commits: [
{ sha: 'b', subject: 'fix: admin', author: 'chehongweo', date: '2026-08-31', body: '' },
{ sha: 'c', subject: 'fix: membership', author: 'cruldra', date: '2026-08-30', body: '' },
],
},
]
describe('filterCherryPickGroups', () => {
it('只勾选的作者才出现', () => {
const out = filterCherryPickGroups(groups, '', new Set(['chehongweo']))
expect(out).toHaveLength(1)
expect(out[0].pr).toBe(260)
expect(out[0].commits.map(c => c.sha)).toEqual(['b'])
})
})
describe('uniqueAuthors', () => {
it('按出现顺序去重', () => {
expect(uniqueAuthors(groups)).toEqual(['cruldra', 'chehongweo'])
})
})