|
1 | 1 | import { describe, it, expect } from 'vitest'; |
2 | 2 |
|
3 | | -import { extractDri, formatDri, formatAssignee } from '../docs/dri.js'; |
| 3 | +import { extractDri, formatDri, formatAssignee, resolveCoderHandle } from '../docs/dri.js'; |
4 | 4 |
|
5 | 5 | const baseOpts = { driToken: 'DRI:@', coderBodyFlag: 'coder', coderLabelFlag: 'op_mia' }; |
6 | 6 |
|
@@ -45,3 +45,19 @@ describe('format helpers', () => { |
45 | 45 | expect(text).toContain('pls code'); |
46 | 46 | }); |
47 | 47 | }); |
| 48 | + |
| 49 | +describe('resolveCoderHandle', () => { |
| 50 | + it('returns DRI handle when author is MIA', () => { |
| 51 | + const item = { user: { login: 'bob' }, labels: [{ name: 'DRI:@alice' }, { name: 'op_mia' }] }; |
| 52 | + const dri = extractDri(item, baseOpts); |
| 53 | + const handle = resolveCoderHandle(item, dri, baseOpts); |
| 54 | + expect(handle).toBe('@alice'); |
| 55 | + }); |
| 56 | + |
| 57 | + it('returns not found when author is MIA but DRI is missing', () => { |
| 58 | + const item = { user: { login: 'bob' }, labels: [{ name: 'op_mia' }] }; |
| 59 | + const dri = extractDri(item, baseOpts); |
| 60 | + const handle = resolveCoderHandle(item, dri, baseOpts); |
| 61 | + expect(handle).toBe('not found'); |
| 62 | + }); |
| 63 | +}); |
0 commit comments