fix(pdf): report:compare --diff follows the privacy default, generic reason on a malformed attachment, Unicode control and format characters escaped, regular files only
This commit is contained in:
1 parent
b1b3e4927e
commit
388e209ea9
4 files changed
+48
-20
No files matched your search
@@ -183,12 +183,27 @@ describe('diff and arguments', () => {
|
||||
const a = compareRaw(v2)
|
||||
const b = compareRaw(migrated)
|
||||
expect(diffLines(a.normalized, b.normalized)).toEqual([])
|
||||
const edited = { ...migrated, conclusion: 'changed' }
|
||||
expect(diffLines(a.normalized, compareRaw(edited).normalized)).toEqual([
|
||||
'+ conclusion "changed"',
|
||||
const added = { ...migrated, conclusion: 'changed' }
|
||||
expect(diffLines(a.normalized, compareRaw(added).normalized)).toEqual([
|
||||
'+ conclusion (present)',
|
||||
])
|
||||
})
|
||||
|
||||
it('compares placeholders by default and real texts with --full', () => {
|
||||
const base = readReportDocument(minimalV2(), sheet.sheet.migrationMap)
|
||||
const original = { ...base.report, conclusion: 'original' }
|
||||
const edited = { ...base.report, conclusion: 'changed' }
|
||||
expect(
|
||||
diffLines(compareRaw(original).normalized, compareRaw(edited).normalized),
|
||||
).toEqual([])
|
||||
expect(
|
||||
diffLines(
|
||||
compareRaw(original, true).normalized,
|
||||
compareRaw(edited, true).normalized,
|
||||
),
|
||||
).toEqual(['- conclusion "original"', '+ conclusion "changed"'])
|
||||
})
|
||||
|
||||
it('parses files and options, refuses unknown ones', () => {
|
||||
expect(parseArgs(['a.pdf', '--summary', 'dir', '--locale', 'en'])).toEqual({
|
||||
files: ['a.pdf', 'dir'],
|
||||
@@ -223,7 +238,7 @@ describe('terminal safety and privacy', () => {
|
||||
},
|
||||
],
|
||||
freeTextFindings: [`t${ESC}\nu`],
|
||||
comment: `c${ESC}\nd`,
|
||||
comment: `c${ESC}\nd\u009b\u202e\u2028`,
|
||||
},
|
||||
],
|
||||
})
|
||||
@@ -234,6 +249,12 @@ describe('terminal safety and privacy', () => {
|
||||
expect(text).toContain('\\u001b')
|
||||
expect(text).toContain('\\u000a')
|
||||
expect(text).toContain('[o\\u001b[2K\\u000a1]')
|
||||
for (const raw of ['\u009b', '\u202e', '\u2028']) {
|
||||
expect(text).not.toContain(raw)
|
||||
}
|
||||
for (const escaped of ['\\u009b', '\\u202e', '\\u2028']) {
|
||||
expect(text).toContain(escaped)
|
||||
}
|
||||
})
|
||||
|
||||
it('does not throw on prototype-chain names used as legacy ids', () => {
|
||||
@@ -288,7 +309,8 @@ describe('terminal safety and privacy', () => {
|
||||
for (const word of ['TEXT', 'COMMENT', 'CONCLUSION', 'RECO', 'WHEN']) {
|
||||
expect(shown).toContain(`SECRET-${word}`)
|
||||
}
|
||||
expect(compareRaw(report).normalized.join('\n')).toContain(
|
||||
expect(compareRaw(report).normalized.join('\n')).not.toContain('SECRET')
|
||||
expect(compareRaw(report, true).normalized.join('\n')).toContain(
|
||||
'SECRET-CONCLUSION',
|
||||
)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user