mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-02 23:14:33 +01:00
fix(review): a wholly bold printed: REVIEWED_TREE line is read (GST-776 fix-check)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
d2c69984d5
commit
29ad9cbd22
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -156,7 +156,7 @@ export function checkoutRoot(): string {
|
||||
* backtick wrapper, a bold label and backticks around the sha or the whole path are removed; the path's own characters are kept.
|
||||
*/
|
||||
function parseTreeLine(line: string): string | null {
|
||||
const label = /^(?:\*\*)?[Pp]rinted:(?:\*\*)?\s+/;
|
||||
const label = /^(?:\*\*[Pp]rinted:\*\*|[Pp]rinted:)\s+/;
|
||||
let t = line.trim().replace(/^(?:[-*>]\s+|\d+[.)]\s+|#+\s+)/, '').replace(label, '');
|
||||
for (const w of ['**', '`']) if (t.length > 2 * w.length && t.startsWith(w) && t.endsWith(w)) t = t.slice(w.length, -w.length).trim();
|
||||
t = t.replace(label, '');
|
||||
|
||||
@@ -593,7 +593,7 @@ describe('the REVIEWED_TREE line as GBRA-218 readers wrote it (GST-776)', () =>
|
||||
expect(checkReviewedTree(reply(`${'b'.repeat(40)} ${top}`), `${tree} ${top}`)).toMatchObject({ ok: false, moved: true, reported: `${'b'.repeat(40)} ${top}` });
|
||||
expect(checkReviewedTree(reply(`${tree} /elsewhere`), `${tree} ${top}`)).toMatchObject({ ok: false, moved: false, reported: `${tree} /elsewhere` });
|
||||
expect(checkReviewedTree(`Note: REVIEWED_TREE: ${tree} ${top}\nNO FINDINGS`, `${tree} ${top}`).reported).toBe('none');
|
||||
for (const line of ['`printed: REVIEWED_TREE: ' + tree + ' ' + top + '`', `**Printed:** REVIEWED_TREE: ${tree} ${top}`]) {
|
||||
for (const line of ['`printed: REVIEWED_TREE: ' + tree + ' ' + top + '`', `**Printed:** REVIEWED_TREE: ${tree} ${top}`, `**printed: REVIEWED_TREE: ${tree} ${top}**`]) {
|
||||
expect(checkReviewedTree(line, `${tree} ${top}`).ok, line).toBe(true);
|
||||
expect(checkReviewedTree(line.replace(tree, 'c'.repeat(40)), `${tree} ${top}`).ok, line).toBe(false);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user