🐛 fix(vscode): 摘修复按 Gitea PR 提交列表分组
This commit is contained in:
1 parent
c0f8da5514
commit
4d3b2a0d67
6 files changed
+193
-34
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { indexCommitsByPull } from './commitPulls'
|
||||
|
||||
describe('indexCommitsByPull', () => {
|
||||
it('用已合并 PR 的提交列表把 sha 对上 PR,不看 commit message', async () => {
|
||||
const map = await indexCommitsByPull(
|
||||
['3e519ea', '5572c4f', 'orphan'],
|
||||
async (page) => {
|
||||
if (page !== 1)
|
||||
return []
|
||||
return [
|
||||
{ number: 260, title: '连续包月会员订阅体系', merged: true, mergeCommitSha: 'merge260' },
|
||||
{ number: 99, title: '还没合', merged: false, mergeCommitSha: null },
|
||||
]
|
||||
},
|
||||
async (index) => {
|
||||
if (index === 260)
|
||||
return ['3e519ea', '5572c4f', 'other']
|
||||
throw new Error(`should not fetch commits for PR ${index}`)
|
||||
},
|
||||
)
|
||||
expect(map.get('3e519ea')).toEqual({ number: 260, title: '连续包月会员订阅体系' })
|
||||
expect(map.get('5572c4f')).toEqual({ number: 260, title: '连续包月会员订阅体系' })
|
||||
expect(map.has('orphan')).toBe(false)
|
||||
})
|
||||
|
||||
it('squash 合入时用 mergeCommitSha 对上', async () => {
|
||||
const map = await indexCommitsByPull(
|
||||
['squashsha'],
|
||||
async () => [{ number: 8, title: 'squash pr', merged: true, mergeCommitSha: 'squashsha' }],
|
||||
async () => ['original-on-branch'],
|
||||
)
|
||||
expect(map.get('squashsha')).toEqual({ number: 8, title: 'squash pr' })
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user